@comake/skl-js-engine
Version:
Standard Knowledge Language Javascript Engine
35 lines • 1.27 kB
TypeScript
export interface LoggerOptions {
maxStringLength?: number;
maxArrayItems?: number;
}
export declare class Logger {
private static instance;
private readonly isDebug;
private metadata;
private readonly maxStringLength;
private readonly maxArrayItems;
private constructor();
/**
* Returns a singleton instance of the logger. The logger honours the DEBUG env variable unless
* explicitly overridden via the `isDebug` parameter.
*/
static getInstance(isDebug?: boolean, metadata?: Record<string, any>, options?: LoggerOptions): Logger;
/**
* Merges the given metadata with the existing metadata attached to the logger.
*/
setMetadata(metadata: Record<string, any>): void;
getMetadataString(): string | undefined;
log(...args: any[]): void;
error(...args: any[]): void;
debug(...args: any[]): void;
/**
* Applies safe formatting to every argument before it is passed to the console. Large strings are
* truncated, large arrays/objects are abbreviated and circular references are handled gracefully
* by `util.inspect`.
*/
private formatArgs;
private formatValue;
private truncateString;
private truncateArray;
}
//# sourceMappingURL=logger.d.ts.map