1
|
|
|
/** |
2
|
|
|
* @callback Writer |
3
|
|
|
* |
4
|
|
|
* @param {string} message Message to write |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @interface IWritable |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @function IWritable#write |
13
|
|
|
* @param {string} message Message to write |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Logger of this kind simply substitute all replace markers in pattern with supplied positional arguments, e.g.: |
18
|
|
|
* |
19
|
|
|
* logger.error('{} has {}', 'admin', 'kicked me out of steam server') => |
20
|
|
|
* '[ERROR] admin has kicked me out of steam server' |
21
|
|
|
* |
22
|
|
|
* @interface IVarArgLogger |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @function IVarArgLogger#log |
27
|
|
|
* |
28
|
|
|
* @param {Level} level Log level |
29
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
30
|
|
|
* @param {...object} parameters List of pattern parameters |
31
|
|
|
*/ |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @function IVarArgLogger#trace |
35
|
|
|
* |
36
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
37
|
|
|
* @param {...object} parameters List of pattern parameters |
38
|
|
|
*/ |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @function IVarArgLogger#debug |
42
|
|
|
* |
43
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
44
|
|
|
* @param {...object} parameters List of pattern parameters |
45
|
|
|
*/ |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @function IVarArgLogger#notice |
49
|
|
|
* |
50
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
51
|
|
|
* @param {...object} parameters List of pattern parameters |
52
|
|
|
*/ |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @function IVarArgLogger#info |
56
|
|
|
* |
57
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
58
|
|
|
* @param {...object} parameters List of pattern parameters |
59
|
|
|
*/ |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @function IVarArgLogger#warn |
63
|
|
|
* |
64
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
65
|
|
|
* @param {...object} parameters List of pattern parameters |
66
|
|
|
*/ |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @function IVarArgLogger#error |
70
|
|
|
* |
71
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
72
|
|
|
* @param {...object} parameters List of pattern parameters |
73
|
|
|
*/ |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* This kind of logger takes an object as an argument to message and substitutes replace tokens using parameter names |
77
|
|
|
* specified in those markers, e.g.: |
78
|
|
|
* |
79
|
|
|
* logger.error('{name} has {action}', {name: 'admin', action: 'kicked me out of steam server'}) => |
80
|
|
|
* '[ERROR] admin has kicked me out of steam server' |
81
|
|
|
* |
82
|
|
|
* @interface IParameterLogger |
83
|
|
|
* @deprecated Use ParameterLogger that will supersede this one next release |
84
|
|
|
*/ |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @function IParameterLogger#log |
88
|
|
|
* |
89
|
|
|
* @param {Level} level Log level |
90
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
91
|
|
|
* @param {object} parameters Pattern parameters object |
92
|
|
|
*/ |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @function IParameterLogger#trace |
96
|
|
|
* |
97
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
98
|
|
|
* @param {object} parameters Pattern parameters object |
99
|
|
|
*/ |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @function IParameterLogger#debug |
103
|
|
|
* |
104
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
105
|
|
|
* @param {object} parameters Pattern parameters object |
106
|
|
|
*/ |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @function IParameterLogger#notice |
110
|
|
|
* |
111
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
112
|
|
|
* @param {object} parameters Pattern parameters object |
113
|
|
|
*/ |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @function IParameterLogger#info |
117
|
|
|
* |
118
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
119
|
|
|
* @param {object} parameters Pattern parameters object |
120
|
|
|
*/ |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @function IParameterLogger#warn |
124
|
|
|
* |
125
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
126
|
|
|
* @param {object} parameters Pattern parameters object |
127
|
|
|
*/ |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @function IParameterLogger#error |
131
|
|
|
* |
132
|
|
|
* @param {string} pattern Logging pattern. It is recommended to use `{}` as a place for substitution |
133
|
|
|
* @param {object} parameters Pattern parameters object |
134
|
|
|
*/ |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @interface ILoggerContext |
138
|
|
|
* @template T |
139
|
|
|
*/ |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @function ILoggerContext#create |
143
|
|
|
* |
144
|
|
|
* @param {string} name Dot-delimited package name logger is created for |
145
|
|
|
* @param {Level} [level] |
146
|
|
|
* @param {IWritable} [writer] |
147
|
|
|
* |
148
|
|
|
* @return {T} |
149
|
|
|
*/ |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @function ILoggerContext#setLevel |
153
|
|
|
* |
154
|
|
|
* @param {string} name Dot-delimited package name logger is created for |
155
|
|
|
* @param {Level} level |
156
|
|
|
* |
157
|
|
|
* @return {this} |
158
|
|
|
*/ |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @function ILoggerContext#getLevel |
162
|
|
|
* |
163
|
|
|
* @param {string} name Dot-delimited package name logger is created for |
164
|
|
|
* |
165
|
|
|
* @return {Level} |
166
|
|
|
*/ |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @deprecated |
170
|
|
|
* |
171
|
|
|
* @function ILoggerContext#setThreshold |
172
|
|
|
* |
173
|
|
|
* @param {string} name Dot-delimited package name logger is created for |
174
|
|
|
* @param {Level} level |
175
|
|
|
* |
176
|
|
|
* @return {this} |
177
|
|
|
*/ |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @deprecated |
181
|
|
|
* |
182
|
|
|
* @function ILoggerContext#getThreshold |
183
|
|
|
* |
184
|
|
|
* @param {string} name Dot-delimited package name logger is created for |
185
|
|
|
* |
186
|
|
|
* @return {Level} |
187
|
|
|
*/ |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @function ILoggerContext#setWriter |
191
|
|
|
* |
192
|
|
|
* @param {string} name Logger name |
193
|
|
|
* @param {IWritable} |
194
|
|
|
* |
195
|
|
|
* @return {this} |
196
|
|
|
*/ |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @function ILoggerContext#getWriter |
200
|
|
|
* |
201
|
|
|
* @param {string} name Logger name |
202
|
|
|
* |
203
|
|
|
* @return {IWritable} |
204
|
|
|
*/ |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @typedef {Object} LoggerOptions |
208
|
|
|
* |
209
|
|
|
* @property {(IVarArgLogger|IParameterLogger|null)} instance |
210
|
|
|
* @property {(ILoggerContext|null)} context |
211
|
|
|
* @property {(String|null)} name |
212
|
|
|
* @property {(Level|null)} level |
213
|
|
|
* @property {(Object|null)} mdc |
214
|
|
|
*/ |
215
|
|
|
|