-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
55 lines (51 loc) · 1.24 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
interface IMiddlewareOptions {
requiredLogs?: Array<string>;
transform?: Function;
filter?: Function;
}
interface ILoggerOptions {
wrapDepth?: number;
level?: string;
customLevels?: object;
transports?: object;
format?: Function;
overwriteConsole?: boolean;
logExt?: object | Function;
disable?: boolean;
fileInfo?: boolean;
separator?: string;
prettyLog?: boolean;
prettyLogOption?: object;
// 兼容老版本的错误:notStringifyLevles拼写错误
notStringifyLevles?: Array<string>;
notStringifyLevels?: Array<string>;
}
type logReturns = {
level: string;
[key:string]: any
};
type logFunc = (...msg: Array<string | object>) => logReturns;
declare namespace koaLogger {
export function middleware(options: IMiddlewareOptions): Function;
export class logger {
constructor(options: ILoggerOptions);
options: ILoggerOptions;
logger: object;
log: (
level: string,
msg: Array<string | object>,
meta?: object,
isTop?: boolean
) => logReturns;
customFileInfo: (msg: string) => this;
error: logFunc;
warn: logFunc;
info: logFunc;
access: logFunc;
verbose: logFunc;
debug: logFunc;
silly: logFunc;
[key: string]: any;
}
}
export = koaLogger;