UNPKG

1.81 kBTypeScriptView Raw
1export declare type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';
2export interface LoggerService {
3 log(message: any, context?: string): any;
4 error(message: any, trace?: string, context?: string): any;
5 warn(message: any, context?: string): any;
6 debug?(message: any, context?: string): any;
7 verbose?(message: any, context?: string): any;
8}
9export declare class Logger implements LoggerService {
10 protected context?: string;
11 private readonly isTimestampEnabled;
12 private static logLevels;
13 private static lastTimestamp?;
14 protected static instance?: typeof Logger | LoggerService;
15 constructor(context?: string, isTimestampEnabled?: boolean);
16 error(message: any, trace?: string, context?: string): void;
17 log(message: any, context?: string): void;
18 warn(message: any, context?: string): void;
19 debug(message: any, context?: string): void;
20 verbose(message: any, context?: string): void;
21 setContext(context: string): void;
22 getTimestamp(): string;
23 static overrideLogger(logger: LoggerService | LogLevel[] | boolean): void;
24 static log(message: any, context?: string, isTimeDiffEnabled?: boolean): void;
25 static error(message: any, trace?: string, context?: string, isTimeDiffEnabled?: boolean): void;
26 static warn(message: any, context?: string, isTimeDiffEnabled?: boolean): void;
27 static debug(message: any, context?: string, isTimeDiffEnabled?: boolean): void;
28 static verbose(message: any, context?: string, isTimeDiffEnabled?: boolean): void;
29 static getTimestamp(): string;
30 private callFunction;
31 protected getInstance(): typeof Logger | LoggerService;
32 private isLogLevelEnabled;
33 private static printMessage;
34 private static updateAndGetTimestampDiff;
35 private static printStackTrace;
36}