From 338f628627fe83cbd5bd13ca1c857db76e1c9169 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 16 Feb 2021 18:29:42 +0100 Subject: [PATCH] remove option to anonymize --- src/logging/BaseLogger.js | 12 +----------- src/logging/LogItem.js | 20 +++++--------------- src/matrix/Sync.js | 2 +- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/logging/BaseLogger.js b/src/logging/BaseLogger.js index c2cd579f..01e9899d 100644 --- a/src/logging/BaseLogger.js +++ b/src/logging/BaseLogger.js @@ -21,20 +21,10 @@ export class BaseLogger { constructor({platform}) { this._openItems = new Set(); this._platform = platform; - this._anonymize = false; //await platform.settingsStorage.getBool("anonymize", false); - } - - get anonymize() { - return this._anonymize; - } - - set anonymize(value) { - this._anonymize = !!value; - this._platform.settingsStorage.setBool("anonymize", this._anonymize); } run(labelOrValues, callback, logLevel = LogLevel.Info, filterCreator = null) { - const item = new LogItem(labelOrValues, logLevel, null, this._platform, this._anonymize); + const item = new LogItem(labelOrValues, logLevel, null, this._platform.clock); this._openItems.add(item); const finishItem = () => { diff --git a/src/logging/LogItem.js b/src/logging/LogItem.js index 72056f8b..0da040d5 100644 --- a/src/logging/LogItem.js +++ b/src/logging/LogItem.js @@ -17,10 +17,9 @@ limitations under the License. import {LogLevel, LogFilter} from "./LogFilter.js"; export class LogItem { - constructor(labelOrValues, logLevel, filterCreator, platform, anonymize) { - this._platform = platform; - this._anonymize = anonymize; - this._start = platform.clock.now(); + constructor(labelOrValues, logLevel, filterCreator, clock) { + this._clock = clock; + this._start = clock.now(); this._end = null; this._values = typeof labelOrValues === "string" ? {l: labelOrValues} : labelOrValues; this.error = null; @@ -65,15 +64,6 @@ export class LogItem { } } - anonymize(value) { - if (this._anonymize) { - const buffer = this._platform.crypto.digest("SHA-256", this._platform.encoding.utf8.encode(value)); - return this._platform.encoding.base64.encode(buffer); - } else { - return value; - } - } - serialize(filter, depth) { if (this._filterCreator) { filter = this._filterCreator(new LogFilter(filter), this); @@ -165,7 +155,7 @@ export class LogItem { c.finish(); } } - this._end = this._platform.clock.now(); + this._end = this._clock.now(); } } @@ -185,7 +175,7 @@ export class LogItem { if (this._end !== null) { console.trace("log item is finished, additional logs will likely not be recorded"); } - const item = new LogItem(labelOrValues, logLevel, filterCreator, this._platform, this._anonymize); + const item = new LogItem(labelOrValues, logLevel, filterCreator, this._clock); if (this._children === null) { this._children = []; } diff --git a/src/matrix/Sync.js b/src/matrix/Sync.js index 9d9e6904..454c7435 100644 --- a/src/matrix/Sync.js +++ b/src/matrix/Sync.js @@ -193,7 +193,7 @@ export class Sync { const isInitialSync = !syncToken; syncToken = response.next_batch; - log.set("syncToken", log.anonymize(syncToken)); + log.set("syncToken", syncToken); log.set("status", this._status.get()); const roomStates = this._parseRoomsResponse(response.rooms, isInitialSync);