With the deprecation of the old EventLogging pipeline, we need to update the code to remove dead debugging logic and do something that we like going forward. There's a discussion about this in slack, and this task can be used to continue it and record the outcomes.
(note, this task was re-purposed, see the history for the original attempt to clarify odd behavior in Chrome Dev tools and how it disconnected before pagehide fires. This updated task will still consider that and try to explain the problem to devs monitoring the console)
Relevant links:
- codepen showing the issue: https://codepen.io/phuedx/pen/PwYdZwN
- page lifcycle diagram: https://developer.chrome.com/docs/web-platform/page-lifecycle-api/image/page-lifecycle-api-state.svg
In the Slack thread linked above, a handful of WMF SE's reached consensus on the next steps for the EventLogging debug modes:
- Remove the visual debug mode
- Remove eventlogging-display-web rows from the user_properties table
- Keep the console debug mode
- Allow all users to enable the console debug mode
- If the user is logged in, then set a user preference; otherwise, set a value in sessionStorage
- Allow all users to enable the console debug mode for one or more streams
I propose the following API to enable users to manage their preferences:
namespace mw { interface eventLog { /** * Enable debugging for all streams or the specified stream. * * @remarks * * When debugging is enabled, the event is logged to the console * immediately after it is enqueued for submission. * * If `persist` is truthy and you are logged-in, then debugging will * persist across browsing sessions; otherwise debugging will only be * enabled for the duration of the browsing session. * * @param streamName */ enableDebugging( streamName: ?string, persist: ?boolean ); /** * Disable debugging for all streams or the specified stream. * * @see {@link mw.eventLog.enableDebugging} */ disableDebugging( streamName: ?string, persist: ?boolean ); } }