forked from mystiq/hydrogen-web
remove option to anonymize
This commit is contained in:
parent
90cfcad5f1
commit
338f628627
3 changed files with 7 additions and 27 deletions
|
@ -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 = () => {
|
||||
|
|
|
@ -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 = [];
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue