forked from logdna/logger-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
65 lines (60 loc) · 1.69 KB
/
types.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
64
65
declare module "@logdna/logger" {
import { EventEmitter } from 'events';
enum LogLevel {
trace,
debug,
info,
warn,
error,
fatal
}
interface ConstructorOptions {
level?: LogLevel;
tags?: string | string[];
meta?: object;
timeout?: number;
hostname?: string;
mac?: string;
ip?: string;
url?: string;
flushLimit?: number;
flushIntervalMs?: number;
shimProperties?: string[];
indexMeta?: boolean;
app?: string;
env?: string;
baseBackoffMs?: number;
maxBackoffMs?: number;
withCredentials?: boolean;
sendUserAgent?: boolean;
}
interface LogOptions {
level?: LogLevel;
app?: string;
env?: string;
timestamp?: number;
context?: object;
indexMeta?: boolean;
meta?: object;
}
export interface Logger extends EventEmitter {
info(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
warn(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
debug(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
error(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
fatal(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
trace(statement: string | object, options?: Omit<LogOptions, 'level'>): void;
log(statement: string | object, options?: LogOptions): void;
addMetaProperty(key: string, value: any): void;
removeMetaProperty(key: string): void;
flush(): void;
}
export function createLogger(
key: string,
options?: ConstructorOptions
): Logger;
export function setupDefaultLogger(
key: string,
options?: ConstructorOptions
): Logger;
}