remove more non-public methods from ILogItem interface

This commit is contained in:
Bruno Windels 2021-11-17 13:50:56 +01:00
parent 526a818269
commit 42e5fb33ba
3 changed files with 5 additions and 7 deletions

View File

@ -21,7 +21,7 @@ import type {ILogger, ILogExport, FilterCreator, LabelOrValues, LogCallback, ILo
import type {Platform} from "../platform/web/Platform.js"; import type {Platform} from "../platform/web/Platform.js";
export abstract class BaseLogger implements ILogger { export abstract class BaseLogger implements ILogger {
protected _openItems: Set<ILogItem> = new Set(); protected _openItems: Set<LogItem> = new Set();
protected _platform: Platform; protected _platform: Platform;
constructor({platform}) { constructor({platform}) {
@ -68,10 +68,10 @@ export abstract class BaseLogger implements ILogger {
return this._run(item, callback, logLevel, true, filterCreator); return this._run(item, callback, logLevel, true, filterCreator);
} }
_run<T>(item: ILogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: true, filterCreator?: FilterCreator): T; _run<T>(item: LogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: true, filterCreator?: FilterCreator): T;
// we don't return if we don't throw, as we don't have anything to return when an error is caught but swallowed for the fire-and-forget case. // we don't return if we don't throw, as we don't have anything to return when an error is caught but swallowed for the fire-and-forget case.
_run<T>(item: ILogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: false, filterCreator?: FilterCreator): void; _run<T>(item: LogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: false, filterCreator?: FilterCreator): void;
_run<T>(item: ILogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: boolean, filterCreator?: FilterCreator): T | void { _run<T>(item: LogItem, callback: LogCallback<T>, logLevel: LogLevel, wantResult: boolean, filterCreator?: FilterCreator): T | void {
this._openItems.add(item); this._openItems.add(item);
const finishItem = () => { const finishItem = () => {

View File

@ -233,7 +233,7 @@ export class LogItem implements ILogItem {
return err; return err;
} }
child(labelOrValues: LabelOrValues, logLevel?: LogLevel, filterCreator?: FilterCreator): ILogItem { child(labelOrValues: LabelOrValues, logLevel?: LogLevel, filterCreator?: FilterCreator): LogItem {
if (this.end) { if (this.end) {
console.trace("log item is finished, additional logs will likely not be recorded"); console.trace("log item is finished, additional logs will likely not be recorded");
} }

View File

@ -51,8 +51,6 @@ export interface ILogItem {
refDetached(logItem: ILogItem, logLevel?: LogLevel): void; refDetached(logItem: ILogItem, logLevel?: LogLevel): void;
ensureRefId(): void; ensureRefId(): void;
catch(err: Error): Error; catch(err: Error): Error;
finish(): void;
child(labelOrValues: LabelOrValues, logLevel?: LogLevel, filterCreator?: FilterCreator): ILogItem;
serialize(filter: LogFilter, parentStartTime: number | undefined, forced: boolean): ISerializedItem | undefined; serialize(filter: LogFilter, parentStartTime: number | undefined, forced: boolean): ISerializedItem | undefined;
} }