Turn on component debug logs while using app #21532
Labels
A-Developer-Experience
A-Feedback-Reporting
Reporting process for bugs, debug logs (rageshakes), suggestions
O-Occasional
Affects or can be seen by some users regularly or most users rarely
S-Minor
Impairs non-critical functionality or suitable workarounds exist
T-Task
Tasks for the team like planning
Your use case
What would you like to do?
In order to better debug a timeline problem when it occurs in the wild (#21531), I want to enable
DEBUG_SCROLL
in theScrollPanel.tsx
andTimelinePanel.tsx
to see what's going on. But this isn't really possible when I'm using and reproducing problems withdevelop.element.io
in production because the variable constant is already hard-coded in the build. I want a way to toggle this after the fact while using the app (whether that be in the browser devtools console or Labs).This debug log pattern is also used in various components so it would be good to extend our solution to all of the places we want conditional/toggle-able debug logs.
Why would you like to do it?
Get better debug logs to understand what/why went wrong.
How would you like to achieve it?
1. Using
debug
One possible solution is to use the
debug
package where you can selectively enable which debug logs you want to filter and see in the console by regex. We usedebug
on Gitter and it's very nice to work with to get just the logs from the pieces you're interested in.ex.
window.localStorage.debug = '*';
window.localStorage.debug = 'app:scroll-panel:*';
window.localStorage.debug = 'app:scroll-panel:*,app:device-listener:*';
window.localStorage.debug = '';
This could even be a string field in the developer settings if we want to prompt people to give us more detailed logs for their next reproduction.
2. Extending
logger
inmatrix-js-sdk
We can write some more custom pieces of
logger
to accomplish something similar. One problem is that we currently have the default log level set todebug
so all of the existinglogger.debug(...)
already show up in the logs. We want these more in depth logs to not show by default and be able to be toggled on.Also of interest,
matrix-appservice-bridge
->src/components/logging.ts
which has namespaced labeled loggersmatrix-bot-sdk
->src/logging/LogService.ts
has the concept ofmutedModules
to filter out logs.Have you considered any alternatives?
Lots of ways to accomplish!
Additional context
Useful for situations like #21432 (comment)
Related issues:
The text was updated successfully, but these errors were encountered: