-
Notifications
You must be signed in to change notification settings - Fork 21
/
docs.mli
102 lines (91 loc) · 2.47 KB
/
docs.mli
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
type StatsdClient : Object
type KafkaClient : Object
type LogtronLogger := EventEmitter & Logger & {
instrument: (server?: HttpServer, opts?: Object) => void,
destroy: ({
createStream: (meta: Object) => WritableStream
}) => void
}
type Logger := {
trace: (message: String, meta: Object, cb? Callback) => void,
debug: (message: String, meta: Object, cb? Callback) => void,
info: (message: String, meta: Object, cb? Callback) => void,
access?: (message: String, meta: Object, cb? Callback) => void,
warn: (message: String, meta: Object, cb? Callback) => void,
error: (message: String, meta: Object, cb? Callback) => void,
fatal: (message: String, meta: Object, cb? Callback) => void,
writeEntry: (Entry, cb?: Callback) => void,
createChild: (path: String, Object<levelName: String>) => Logger
}
type Entry := {
level: String,
message: String,
meta: Object,
path: String
}
type BackendName := String
type LevelName := String
type Backend := {
createStream: (meta: Object) => {
write: ([
levelName: String,
message: String,
meta: Object
], Callback) => void,
end: () => void,
destroy?: () => void
}
}
type LoggerOpts := {
meta: {
team: String,
project: String,
hostname: String,
pid: Number
},
backends: Object<BackendName, Backend>,
filters?: Array<Function>,
transforms?: Array<Function>,
levels?: Object<LevelName, {
backends: Array<BackendName>,
filters?: Array<Function>,
transforms?: Array<Function>,
level: Number
}>
}
logtron/backends/disk := ({
folder: String
}) => Backend
logtron/backends/kafka := ({
proxyHost?: String,
proxyPort?: Number,
properties?: Object,
statsd?: Object
}) => Backend
logtron/backends/console := () => Backend
logtron/backends/sentry := ({
dsn: String,
defaultTags?: Object,
statsd?: Object
}) => Backend
logtron/logger := ((LoggerOpts) => LogtronLogger) & {
defaultBackends: (config: {
logFolder?: String,
kafka?: {
proxyHost: String,
proxyPort: Number
},
console?: Boolean,
sentry?: {
id: String
}
}, clients?: {
statsd: StatsdClient,
kafkaClient?: KafkaClient
}) => {
disk: Backend | null,
kafka: Backend | null,
console: Backend | null,
sentry: Backend | null
}
}