-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.d.ts
More file actions
74 lines (74 loc) · 1.94 KB
/
Copy pathlogger.d.ts
File metadata and controls
74 lines (74 loc) · 1.94 KB
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
64
65
66
67
68
69
70
71
72
73
74
/// <reference types="node" />
import fs from 'fs';
export interface IMessageLevel {
info: 0;
system: 1;
warn: 2;
error: 3;
critical: 4;
debug: 5;
}
export declare type MessageLevelType = 0 | 1 | 2 | 3 | 4 | 5;
export interface ILogOption {
noPrint?: boolean;
noWrite?: boolean;
noFormat?: boolean;
useProcessOut?: boolean;
level?: MessageLevelType;
}
export declare enum MessageLevelNamesType {
"info" = 0,
"system" = 1,
"warn" = 2,
"error" = 3,
"critical" = 4,
"debug" = 5
}
export declare type LogFormatType = (log: string, level: MessageLevelNamesType, logger: FolderLogger) => string;
export interface ILoggerConstructorOption {
/**
* `txt`
*/
ext?: string;
/**
* `YYYY-MM-DD`
*/
timeFormat?: string;
/**
* `2090-11-11T11:11:11`
*/
momentOption?: string;
level?: MessageLevelType;
logFormat?: LogFormatType;
}
export declare type StreamType = Array<fs.WriteStream | null>;
declare class FolderLogger {
logTime: string | null;
stream: StreamType;
showLevel?: MessageLevelType;
ext?: string;
timeFormat?: string;
logFormat?: LogFormatType;
momentOption?: string;
logPath: string;
constructor(_logPath: string, option?: ILoggerConstructorOption);
get level(): IMessageLevel;
get levelNames(): string[];
/**
*
* @param {number} _level
*/
setLevel(_level: MessageLevelType): this;
info(input: string, option?: ILogOption): this;
system(input: string, option?: ILogOption): this;
warn(input: string, option?: ILogOption): this;
error(input: string, option?: ILogOption): this;
critical(input: string, option?: ILogOption): this;
debug(input: string, option?: ILogOption): this;
log(input: string, option: ILogOption): this;
setLogPath(_logPath: string): this;
checkRefresh(): this;
close(): void;
}
export { FolderLogger };
export default FolderLogger;