-
Notifications
You must be signed in to change notification settings - Fork 175
/
types.ts
54 lines (49 loc) · 1.17 KB
/
types.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
import type { LogLevel, LogType } from "./constants";
export interface ConsolaOptions {
reporters: ConsolaReporter[];
types: Record<LogType, InputLogObject>;
level: LogLevel;
defaults: InputLogObject;
throttle: number;
throttleMin: number;
stdout?: NodeJS.WriteStream;
stderr?: NodeJS.WriteStream;
mockFn?: (type: LogType, defaults: InputLogObject) => (...args: any) => void;
prompt?: typeof import("./prompt").prompt | undefined;
formatOptions: FormatOptions;
}
/**
* @see https://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors
*/
export interface FormatOptions {
columns?: number;
date?: boolean;
colors?: boolean;
compact?: boolean | number;
[key: string]: unknown;
}
export interface InputLogObject {
level?: LogLevel;
tag?: string;
type?: LogType;
message?: string;
additional?: string | string[];
args?: any[];
date?: Date;
}
export interface LogObject extends InputLogObject {
level: LogLevel;
type: LogType;
tag: string;
args: any[];
date: Date;
[key: string]: unknown;
}
export interface ConsolaReporter {
log: (
logObj: LogObject,
ctx: {
options: ConsolaOptions;
},
) => void;
}