-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtypes.d.ts
72 lines (65 loc) · 1.93 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
66
67
68
69
70
71
72
declare module "@logdna/logger" {
import { EventEmitter } from 'events';
export enum LogLevel {
trace = 'TRACE',
debug = 'DEBUG',
info = 'INFO',
warn = 'WARN',
error = 'ERROR',
fatal = 'FATAL'
}
type CustomLevel = string
interface ConstructorOptions {
level?: LogLevel | CustomLevel;
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;
levels?: CustomLevel[];
maxAttempts?: number;
verboseEvents?: boolean;
ignoreRetryableErrors?: boolean;
}
interface LogOptions {
level?: LogLevel | CustomLevel;
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;
}