Add a way to toggle ScrollPanel and TimelinePanel debug logs (#8513)

Part of https://github.com/vector-im/element-web/issues/21532

To better debug timeline issues when they crop up.

Turn on:
```js
mxSettingsStore.setValue('debug_scroll_panel', null, 'device', true);
mxSettingsStore.setValue('debug_timeline_panel', null, 'device', true);
```

Turn off:
```js
mxSettingsStore.setValue('debug_scroll_panel', null, 'device', false);
mxSettingsStore.setValue('debug_timeline_panel', null, 'device', false);
```
This commit is contained in:
Eric Eastwood 2022-05-06 11:13:23 -05:00 committed by GitHub
parent e97536ef96
commit 46ba14219c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 16 deletions

View file

@ -61,13 +61,11 @@ const READ_RECEIPT_INTERVAL_MS = 500;
const READ_MARKER_DEBOUNCE_MS = 100;
const DEBUG = false;
let debuglog = function(...s: any[]) {};
if (DEBUG) {
// using bind means that we get to keep useful line numbers in the console
debuglog = logger.log.bind(console, "TimelinePanel debuglog:");
}
const debuglog = (...args: any[]) => {
if (SettingsStore.getValue("debug_timeline_panel")) {
logger.log.call(console, "TimelinePanel debuglog:", ...args);
}
};
interface IProps {
// The js-sdk EventTimelineSet object for the timeline sequence we are