1 | import { LoggerWatcher } from './logger-watcher';
|
2 | import { ILoggerServer, LogLevel, rootLoggerName } from './logger-protocol';
|
3 | export { LogLevel, rootLoggerName };
|
4 | export declare let logger: ILogger;
|
5 | /**
|
6 | * Counterpart of the `#setRootLogger(ILogger)`. Restores the `console.xxx` bindings to the original one.
|
7 | * Invoking has no side-effect if `setRootLogger` was not called before. Multiple function invocation has
|
8 | * no side-effect either.
|
9 | */
|
10 | export declare function unsetRootLogger(): void;
|
11 | export declare function setRootLogger(aLogger: ILogger): void;
|
12 | export type Log = (message: any, ...params: any[]) => void;
|
13 | export type Loggable = (log: Log) => void;
|
14 | export declare const LoggerFactory: unique symbol;
|
15 | export type LoggerFactory = (name: string) => ILogger;
|
16 | export declare const LoggerName: unique symbol;
|
17 | export declare const ILogger: unique symbol;
|
18 | export interface ILogger {
|
19 | /**
|
20 | * Set the log level.
|
21 | *
|
22 | * @param loglevel - The loglevel to set. see Logger.LogLevel for
|
23 | * possible options.
|
24 | */
|
25 | setLogLevel(logLevel: number): Promise<void>;
|
26 | /**
|
27 | * Get the log level.
|
28 | *
|
29 | * @returns a Promise to the log level.
|
30 | */
|
31 | getLogLevel(): Promise<number>;
|
32 | /**
|
33 | * Test whether the given log level is enabled.
|
34 | */
|
35 | isEnabled(logLevel: number): Promise<boolean>;
|
36 | /**
|
37 | * Resolve if the given log is enabled.
|
38 | */
|
39 | ifEnabled(logLevel: number): Promise<void>;
|
40 | /**
|
41 | * Log a loggable with the given level if it is enabled.
|
42 | */
|
43 | log(logLevel: number, loggable: Loggable): Promise<void>;
|
44 | /**
|
45 | * Log a message with the given level if it is enabled.
|
46 | *
|
47 | * @param logLevel - The loglevel to use.
|
48 | * @param message - The message format string.
|
49 | * @param params - The format string variables.
|
50 | */
|
51 | log(logLevel: number, message: any, ...params: any[]): void;
|
52 | /**
|
53 | * Test whether the trace level is enabled.
|
54 | */
|
55 | isTrace(): Promise<boolean>;
|
56 | /**
|
57 | * Resolve if the trace level is enabled.
|
58 | */
|
59 | ifTrace(): Promise<void>;
|
60 | /**
|
61 | * Log a loggable with the trace level if it is enabled.
|
62 | */
|
63 | trace(loggable: Loggable): Promise<void>;
|
64 | /**
|
65 | * Log a message with the trace level if it is enabled.
|
66 | *
|
67 | * @param message - The message format string.
|
68 | * @param params - The format string variables.
|
69 | */
|
70 | trace(message: any, ...params: any[]): Promise<void>;
|
71 | /**
|
72 | * Test whether the debug level is enabled.
|
73 | */
|
74 | isDebug(): Promise<boolean>;
|
75 | /**
|
76 | * Resolve if the debug level is enabled.
|
77 | */
|
78 | ifDebug(): Promise<void>;
|
79 | /**
|
80 | * Log a loggable with the debug level if it is enabled.
|
81 | */
|
82 | debug(loggable: Loggable): Promise<void>;
|
83 | /**
|
84 | * Log a message with the debug level if it is enabled.
|
85 | *
|
86 | * @param message - The message format string.
|
87 | * @param params - The format string variables.
|
88 | */
|
89 | debug(message: any, ...params: any[]): Promise<void>;
|
90 | /**
|
91 | * Test whether the info level is enabled.
|
92 | */
|
93 | isInfo(): Promise<boolean>;
|
94 | /**
|
95 | * Resolve if the info level is enabled.
|
96 | */
|
97 | ifInfo(): Promise<void>;
|
98 | /**
|
99 | * Log a loggable with the info level if it is enabled.
|
100 | */
|
101 | info(loggable: Loggable): Promise<void>;
|
102 | /**
|
103 | * Log a message with the info level if it is enabled.
|
104 | *
|
105 | * @param message - The message format string.
|
106 | * @param params - The format string variables.
|
107 | */
|
108 | info(message: any, ...params: any[]): Promise<void>;
|
109 | /**
|
110 | * Test whether the warn level is enabled.
|
111 | */
|
112 | isWarn(): Promise<boolean>;
|
113 | /**
|
114 | * Resolve if the warn level is enabled.
|
115 | */
|
116 | ifWarn(): Promise<void>;
|
117 | /**
|
118 | * Log a loggable with the warn level if it is enabled.
|
119 | */
|
120 | warn(loggable: Loggable): Promise<void>;
|
121 | /**
|
122 | * Log a message with the warn level if it is enabled.
|
123 | *
|
124 | * @param message - The message format string.
|
125 | * @param params - The format string variables.
|
126 | */
|
127 | warn(message: any, ...params: any[]): Promise<void>;
|
128 | /**
|
129 | * Test whether the error level is enabled.
|
130 | */
|
131 | isError(): Promise<boolean>;
|
132 | /**
|
133 | * Resolve if the error level is enabled.
|
134 | */
|
135 | ifError(): Promise<void>;
|
136 | /**
|
137 | * Log a loggable with the error level if it is enabled.
|
138 | */
|
139 | error(loggable: Loggable): Promise<void>;
|
140 | /**
|
141 | * Log a message with the error level.
|
142 | *
|
143 | * @param message - The message format string.
|
144 | * @param params - The format string variables.
|
145 | */
|
146 | error(message: any, ...params: any[]): Promise<void>;
|
147 | /**
|
148 | * Test whether the fatal level is enabled.
|
149 | */
|
150 | isFatal(): Promise<boolean>;
|
151 | /**
|
152 | * Resolve if the fatal level is enabled.
|
153 | */
|
154 | ifFatal(): Promise<void>;
|
155 | /**
|
156 | * Log a loggable with the fatal level if it is enabled.
|
157 | */
|
158 | fatal(loggable: Loggable): Promise<void>;
|
159 | /**
|
160 | * Log a message with the fatal level if it is enabled.
|
161 | *
|
162 | * @param message - The message format string.
|
163 | * @param params - The format string variables.
|
164 | */
|
165 | fatal(message: any, ...params: any[]): Promise<void>;
|
166 | /**
|
167 | * Create a child logger from this logger.
|
168 | *
|
169 | * @param name - The name of the child logger.
|
170 | */
|
171 | child(name: string): ILogger;
|
172 | }
|
173 | export declare class Logger implements ILogger {
|
174 | protected _logLevel: Promise<number>;
|
175 | protected created: Promise<void>;
|
176 | protected readonly server: ILoggerServer;
|
177 | protected readonly loggerWatcher: LoggerWatcher;
|
178 | protected readonly factory: LoggerFactory;
|
179 | protected name: string;
|
180 | protected init(): void;
|
181 | setLogLevel(logLevel: number): Promise<void>;
|
182 | getLogLevel(): Promise<number>;
|
183 | isEnabled(logLevel: number): Promise<boolean>;
|
184 | ifEnabled(logLevel: number): Promise<void>;
|
185 | log(logLevel: number, arg2: any | Loggable, ...params: any[]): Promise<void>;
|
186 | protected getLog(logLevel: number): Promise<Log>;
|
187 | protected format(value: any): any;
|
188 | isTrace(): Promise<boolean>;
|
189 | ifTrace(): Promise<void>;
|
190 | trace(arg: any | Loggable, ...params: any[]): Promise<void>;
|
191 | isDebug(): Promise<boolean>;
|
192 | ifDebug(): Promise<void>;
|
193 | debug(arg: any | Loggable, ...params: any[]): Promise<void>;
|
194 | isInfo(): Promise<boolean>;
|
195 | ifInfo(): Promise<void>;
|
196 | info(arg: any | Loggable, ...params: any[]): Promise<void>;
|
197 | isWarn(): Promise<boolean>;
|
198 | ifWarn(): Promise<void>;
|
199 | warn(arg: any | Loggable, ...params: any[]): Promise<void>;
|
200 | isError(): Promise<boolean>;
|
201 | ifError(): Promise<void>;
|
202 | error(arg: any | Loggable, ...params: any[]): Promise<void>;
|
203 | isFatal(): Promise<boolean>;
|
204 | ifFatal(): Promise<void>;
|
205 | fatal(arg: any | Loggable, ...params: any[]): Promise<void>;
|
206 | child(name: string): ILogger;
|
207 | }
|
208 | //# sourceMappingURL=logger.d.ts.map |
\ | No newline at end of file |