From 55401a746c6d46e57fedfdb75932bf8e109247b7 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Tue, 9 Nov 2021 22:28:26 +0530 Subject: [PATCH] Move type alias to LogItem and add more type annotations --- src/logging/BaseLogger.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/logging/BaseLogger.ts b/src/logging/BaseLogger.ts index 7117f9d9..27dd4983 100644 --- a/src/logging/BaseLogger.ts +++ b/src/logging/BaseLogger.ts @@ -15,16 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -import {LogItem} from "./LogItem.js"; +import {LogItem, LabelOrValues, FilterCreator} from "./LogItem"; import {LogLevel, LogFilter} from "./LogFilter.js"; import {Platform} from "../platform/web/Platform.js"; -// todo: move this to LogItem? -type LabelOrValues = string | {l: string; [key: string]: unknown}; type LogCallback = (item: LogItem) => Promise | undefined; -// todo: this should be an enum -type LogLevel = number | null; -type FilterCreator = ((filter: LogFilter, item: LogItem) => LogFilter) | null; export abstract class BaseLogger { protected _openItems: Set = new Set(); @@ -36,7 +31,7 @@ export abstract class BaseLogger { log(labelOrValues: LabelOrValues, logLevel: number = LogLevel.Info) { const item = new LogItem(labelOrValues, logLevel, null, this); - item._end = item._start; + item.end = item.start; this._persistItem(item, null, false); } @@ -146,7 +141,7 @@ export abstract class BaseLogger { return LogLevel; } - _now() { + _now(): number { return this._platform.clock.now(); }