-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
63 lines (63 loc) · 1.59 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export interface IPlugins {
renderNamespace: (severity: Severity, namespace: string) => string;
}
export declare const definePlugin: {
renderNamespace(plugin: (severity: Severity, namespace: string) => string): void;
};
/**
* Severity of the message
*/
declare type Severity = 'trace' | 'log' | 'warn' | 'error';
interface IConsole {
(...args: any[]): void;
enabled: boolean;
}
interface ILogger {
trace: IConsole;
log: IConsole;
warn: IConsole;
error: IConsole;
}
/**
* Minimum severity level of displayed messages
*/
export declare enum Level {
Trace = 0,
Log = 1,
Warn = 2,
Error = 3,
Silent = 4
}
export declare const setDefaultLevel: (level: Level) => void;
export declare const disableInProduction: () => void;
declare function noop(): void;
export declare const bindTo: {
consoleFactory: (severity: Severity, namespace: string) => (...args: any[]) => void;
noop: typeof noop;
};
export declare class Logger implements ILogger {
private ns;
private lvl;
trace: IConsole;
log: IConsole;
warn: IConsole;
error: IConsole;
constructor(ns: string, lvl: Level);
readonly namespace: string;
level: Level;
}
interface ILevelState {
[namespace: string]: Level;
}
export declare const getLevelState: (config: string) => ILevelState;
interface ILoggerState {
[namespace: string]: Logger;
}
export interface IState {
level: ILevelState;
logger: ILoggerState;
}
export declare const state: IState;
export declare const cleanState: () => void;
export declare const getLogger: (namespace: string) => Logger;
export {};