Invert logging

pull/21833/head
Travis Ralston 2020-07-14 13:18:06 -06:00
parent 7a1635e7bc
commit f6b9d44e4b
4 changed files with 38 additions and 37 deletions

View File

@ -41,7 +41,7 @@ declare global {
mxPlatformPeg: PlatformPeg;
// TODO: Remove flag before launch: https://github.com/vector-im/riot-web/issues/14231
mx_QuietRoomListLogging: boolean;
mx_LoudRoomListLogging: boolean;
}
// workaround for https://github.com/microsoft/TypeScript/issues/30933

View File

@ -210,7 +210,7 @@ export default class RoomList2 extends React.Component<IProps, IState> {
private updateLists = () => {
const newLists = RoomListStore.instance.orderedLists;
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log("new lists", newLists);
}

View File

@ -33,6 +33,7 @@ import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
import RoomListLayoutStore from "./RoomListLayoutStore";
import { MarkedExecution } from "../../utils/MarkedExecution";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import { MatrixClientPeg } from "../../MatrixClientPeg";
interface IState {
tagsEnabled?: boolean;
@ -154,7 +155,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
console.warn(`${activeRoomId} is current in RVS but missing from client - clearing sticky room`);
await this.algorithm.setStickyRoom(null);
} else if (activeRoom !== this.algorithm.stickyRoom) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Changing sticky room to ${activeRoomId}`);
}
@ -218,7 +219,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
console.warn(`Own read receipt was in unknown room ${room.roomId}`);
return;
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Got own read receipt in ${room.roomId}`);
}
@ -228,7 +229,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
} else if (payload.action === 'MatrixActions.Room.tags') {
const roomPayload = (<any>payload); // TODO: Type out the dispatcher types
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Got tag change in ${roomPayload.room.roomId}`);
}
@ -243,13 +244,13 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
const roomId = eventPayload.event.getRoomId();
const room = this.matrixClient.getRoom(roomId);
const tryUpdate = async (updatedRoom: Room) => {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Live timeline event ${eventPayload.event.getId()}` +
` in ${updatedRoom.roomId}`);
}
if (eventPayload.event.getType() === 'm.room.tombstone' && eventPayload.event.getStateKey() === '') {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Got tombstone event - trying to remove now-dead room`);
}
@ -282,7 +283,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
console.warn(`Event ${eventPayload.event.getId()} was decrypted in an unknown room ${roomId}`);
return;
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Decrypted timeline event ${eventPayload.event.getId()} in ${roomId}`);
}
@ -290,7 +291,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
this.updateFn.trigger();
} else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') {
const eventPayload = (<any>payload); // TODO: Type out the dispatcher types
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Received updated DM map`);
}
@ -317,7 +318,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
const oldMembership = getEffectiveMembership(membershipPayload.oldMembership);
const newMembership = getEffectiveMembership(membershipPayload.membership);
if (oldMembership !== EffectiveMembership.Join && newMembership === EffectiveMembership.Join) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Handling new room ${membershipPayload.room.roomId}`);
}
@ -326,7 +327,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
// the dead room in the list.
const createEvent = membershipPayload.room.currentState.getStateEvents("m.room.create", "");
if (createEvent && createEvent.getContent()['predecessor']) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Room has a predecessor`);
}
@ -334,7 +335,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
if (prevRoom) {
const isSticky = this.algorithm.stickyRoom === prevRoom;
if (isSticky) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Clearing sticky room due to room upgrade`);
}
@ -343,7 +344,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
// Note: we hit the algorithm instead of our handleRoomUpdate() function to
// avoid redundant updates.
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Removing previous room from room list`);
}
@ -351,7 +352,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Adding new room to room list`);
}
@ -361,7 +362,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
if (oldMembership !== EffectiveMembership.Invite && newMembership === EffectiveMembership.Invite) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Handling invite to ${membershipPayload.room.roomId}`);
}
@ -372,7 +373,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
// If it's not a join, it's transitioning into a different list (possibly historical)
if (oldMembership !== newMembership) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Handling membership change in ${membershipPayload.room.roomId}`);
}
@ -386,7 +387,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<any> {
const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause);
if (shouldUpdate) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[DEBUG] Room "${room.name}" (${room.roomId}) triggered by ${cause} requires list update`);
}
@ -509,7 +510,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
private onAlgorithmListUpdated = () => {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log("Underlying algorithm has triggered a list update - marking");
}
@ -559,7 +560,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
public addFilter(filter: IFilterCondition): void {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log("Adding filter condition:", filter);
}
@ -571,7 +572,7 @@ export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
}
public removeFilter(filter: IFilterCondition): void {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log("Removing filter condition:", filter);
}

View File

@ -320,7 +320,7 @@ export class Algorithm extends EventEmitter {
}
newMap[tagId] = allowedRoomsInThisTag;
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[DEBUG] ${newMap[tagId].length}/${rooms.length} rooms filtered into ${tagId}`);
}
@ -335,7 +335,7 @@ export class Algorithm extends EventEmitter {
protected recalculateFilteredRoomsForTag(tagId: TagID): void {
if (!this.hasFilters) return; // don't bother doing work if there's nothing to do
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Recalculating filtered rooms for ${tagId}`);
}
@ -347,7 +347,7 @@ export class Algorithm extends EventEmitter {
this.filteredRooms[tagId] = filteredRooms;
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[DEBUG] ${filteredRooms.length}/${rooms.length} rooms filtered into ${tagId}`);
}
@ -389,7 +389,7 @@ export class Algorithm extends EventEmitter {
}
if (!this._cachedStickyRooms || !updatedTag) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Generating clone of cached rooms for sticky room handling`);
}
@ -403,7 +403,7 @@ export class Algorithm extends EventEmitter {
if (updatedTag) {
// Update the tag indicated by the caller, if possible. This is mostly to ensure
// our cache is up to date.
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Replacing cached sticky rooms for ${updatedTag}`);
}
@ -415,7 +415,7 @@ export class Algorithm extends EventEmitter {
// we might have updated from the cache is also our sticky room.
const sticky = this._stickyRoom;
if (!updatedTag || updatedTag === sticky.tag) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Inserting sticky room ${sticky.room.roomId} at position ${sticky.position} in ${sticky.tag}`);
}
@ -643,7 +643,7 @@ export class Algorithm extends EventEmitter {
* processing.
*/
public async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise<boolean> {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Handle room update for ${room.roomId} called with cause ${cause}`);
}
@ -703,7 +703,7 @@ export class Algorithm extends EventEmitter {
const diff = arrayDiff(oldTags, newTags);
if (diff.removed.length > 0 || diff.added.length > 0) {
for (const rmTag of diff.removed) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Removing ${room.roomId} from ${rmTag}`);
}
@ -713,7 +713,7 @@ export class Algorithm extends EventEmitter {
this.cachedRooms[rmTag] = algorithm.orderedRooms;
}
for (const addTag of diff.added) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Adding ${room.roomId} to ${addTag}`);
}
@ -726,14 +726,14 @@ export class Algorithm extends EventEmitter {
// Update the tag map so we don't regen it in a moment
this.roomIdsToTags[room.roomId] = newTags;
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Changing update cause for ${room.roomId} to Timeline to sort rooms`);
}
cause = RoomUpdateCause.Timeline;
didTagChange = true;
} else {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`Received no-op update for ${room.roomId} - changing to Timeline update`);
}
@ -762,7 +762,7 @@ export class Algorithm extends EventEmitter {
// as the sticky room relies on this.
if (cause !== RoomUpdateCause.NewRoom && cause !== RoomUpdateCause.RoomRemoved) {
if (this.stickyRoom === room) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.warn(`[RoomListDebug] Received ${cause} update for sticky room ${room.roomId} - ignoring`);
}
@ -772,14 +772,14 @@ export class Algorithm extends EventEmitter {
if (!this.roomIdsToTags[room.roomId]) {
if (CAUSES_REQUIRING_ROOM.includes(cause)) {
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.warn(`Skipping tag update for ${room.roomId} because we don't know about the room`);
}
return false;
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Updating tags for room ${room.roomId} (${room.name})`);
}
@ -793,13 +793,13 @@ export class Algorithm extends EventEmitter {
this.roomIdsToTags[room.roomId] = roomTags;
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Updated tags for ${room.roomId}:`, roomTags);
}
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Reached algorithmic handling for ${room.roomId} and cause ${cause}`);
}
@ -824,7 +824,7 @@ export class Algorithm extends EventEmitter {
changed = true;
}
if (!window.mx_QuietRoomListLogging) {
if (window.mx_LoudRoomListLogging) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035
console.log(`[RoomListDebug] Finished handling ${room.roomId} with cause ${cause} (changed=${changed})`);
}