From e14929bd4f182f5d58874ddcbece4179300eba45 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 17 Feb 2021 17:14:50 +0100 Subject: [PATCH] inherit log level from parent rather than defaulting to info if not set --- src/logging/LogItem.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/logging/LogItem.js b/src/logging/LogItem.js index ac376e5e..dc713e89 100644 --- a/src/logging/LogItem.js +++ b/src/logging/LogItem.js @@ -32,7 +32,7 @@ export class LogItem { /** * Creates a new child item and runs it in `callback`. */ - wrap(labelOrValues, callback, logLevel = LogLevel.Info, filterCreator = null) { + wrap(labelOrValues, callback, logLevel = null, filterCreator = null) { const item = this.child(labelOrValues, logLevel, filterCreator); return item.run(callback); } @@ -51,7 +51,7 @@ export class LogItem { * * Hence, the child item is not returned. */ - log(labelOrValues, logLevel = LogLevel.Info) { + log(labelOrValues, logLevel = null) { const item = this.child(labelOrValues, logLevel, null); item.end = item.start; } @@ -180,6 +180,9 @@ export class LogItem { if (this._end !== null) { console.trace("log item is finished, additional logs will likely not be recorded"); } + if (!logLevel) { + logLevel = this.logLevel || LogLevel.Info; + } const item = new LogItem(labelOrValues, logLevel, filterCreator, this._clock); if (this._children === null) { this._children = [];