UNPKG

1.58 kBTypeScriptView Raw
1declare interface ConsolaReporter {
2 log: (logObj: any, { async, stdout, stderr }: any) => void
3}
4
5declare class Consola {
6 // Built-in log levels
7 static fatal (message: any): void;
8 static error (message: any): void;
9 static warn (message: any): void;
10 static log (message: any): void;
11 static info (message: any): void;
12 static start (message: any): void;
13 static success (message: any): void;
14 static ready (message: any): void;
15 static debug (message: any): void;
16 static trace(message: any): void;
17
18 // Create
19 static create(options: any): (typeof Consola);
20 static withDefaults(defaults: any): (typeof Consola);
21
22 static withTag(tag: string): (typeof Consola);
23 static withScope(tag: string): (typeof Consola);
24
25 // Reporter
26 static addReporter(reporter: ConsolaReporter): (typeof Consola);
27 static setReporters(reporters: Array<ConsolaReporter>): (typeof Consola);
28
29 static removeReporter(reporter: any): (typeof Consola);
30 static remove(reporter: any): (typeof Consola);
31 static clear(reporter: any): (typeof Consola);
32
33 // Wrappers
34 static wrapAll(): void;
35 static restoreAll(): void;
36 static wrapConsole(): void;
37 static restoreConsole(): void;
38 static wrapStd(): void;
39 static restoreStd(): void;
40
41 // Pause/Resume
42 static pauseLogs(): void;
43 static pause(): void;
44
45 static resumeLogs(): void;
46 static resume(): void;
47
48 // Mock
49 static mockTypes(mockFn: any): any;
50 static mock(mockFn: any): any;
51}
52
53declare module "consola" {
54 export default Consola;
55}