@athenna/logger 3.0.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/Drivers/ConsoleDriver.d.ts +12 -0
- package/build/Drivers/ConsoleDriver.js +19 -0
- package/build/Drivers/DiscordDriver.d.ts +12 -0
- package/build/Drivers/DiscordDriver.js +22 -0
- package/build/Drivers/Driver.d.ts +52 -0
- package/build/Drivers/Driver.js +85 -0
- package/build/Drivers/FileDriver.d.ts +12 -0
- package/build/Drivers/FileDriver.js +24 -0
- package/build/Drivers/NullDriver.d.ts +12 -0
- package/build/Drivers/NullDriver.js +14 -0
- package/build/Drivers/SlackDriver.d.ts +12 -0
- package/build/Drivers/SlackDriver.js +19 -0
- package/build/Drivers/StackDriver.d.ts +12 -0
- package/build/Drivers/StackDriver.js +19 -0
- package/build/Drivers/TelegramDriver.d.ts +12 -0
- package/build/Drivers/TelegramDriver.js +21 -0
- package/build/Exceptions/DriverExistException.d.ts +12 -0
- package/build/Exceptions/DriverExistException.js +21 -0
- package/{src/Facades/Log.js → build/Exceptions/FormatterExistException.d.ts} +4 -9
- package/build/Exceptions/FormatterExistException.js +21 -0
- package/build/Exceptions/NotFoundDriverException.d.ts +12 -0
- package/build/Exceptions/NotFoundDriverException.js +21 -0
- package/build/Exceptions/NotFoundFormatterException.d.ts +12 -0
- package/build/Exceptions/NotFoundFormatterException.js +21 -0
- package/build/Exceptions/NotImplementedConfigException.d.ts +12 -0
- package/build/Exceptions/NotImplementedConfigException.js +28 -0
- package/build/Facades/Log.d.ts +10 -0
- package/build/Facades/Log.js +10 -0
- package/build/Factories/DriverFactory.d.ts +39 -0
- package/build/Factories/DriverFactory.js +93 -0
- package/build/Factories/FormatterFactory.d.ts +29 -0
- package/build/Factories/FormatterFactory.js +57 -0
- package/build/Formatters/CliFormatter.d.ts +12 -0
- package/build/Formatters/CliFormatter.js +15 -0
- package/build/Formatters/Formatter.d.ts +85 -0
- package/build/Formatters/Formatter.js +177 -0
- package/build/Formatters/JsonFormatter.d.ts +12 -0
- package/build/Formatters/JsonFormatter.js +26 -0
- package/build/Formatters/MessageFormatter.d.ts +12 -0
- package/build/Formatters/MessageFormatter.js +14 -0
- package/build/Formatters/NoneFormatter.d.ts +12 -0
- package/{src → build}/Formatters/NoneFormatter.js +4 -12
- package/build/Formatters/RequestFormatter.d.ts +12 -0
- package/build/Formatters/RequestFormatter.js +45 -0
- package/build/Formatters/SimpleFormatter.d.ts +12 -0
- package/build/Formatters/SimpleFormatter.js +18 -0
- package/build/Helpers/ColorHelper.d.ts +131 -0
- package/build/Helpers/ColorHelper.js +215 -0
- package/build/Helpers/FactoryHelper.d.ts +14 -0
- package/build/Helpers/FactoryHelper.js +20 -0
- package/build/Logger/Logger.d.ts +68 -0
- package/build/Logger/Logger.js +105 -0
- package/build/Logger/VanillaLogger.d.ts +60 -0
- package/build/Logger/VanillaLogger.js +86 -0
- package/build/Providers/LoggerProvider.d.ts +12 -0
- package/{src → build}/Providers/LoggerProvider.js +5 -12
- package/build/index.d.ts +18 -0
- package/build/index.js +18 -0
- package/package.json +81 -59
- package/src/Drivers/ConsoleDriver.js +0 -40
- package/src/Drivers/DiscordDriver.js +0 -43
- package/src/Drivers/Driver.js +0 -134
- package/src/Drivers/FileDriver.js +0 -47
- package/src/Drivers/NullDriver.js +0 -33
- package/src/Drivers/SlackDriver.js +0 -40
- package/src/Drivers/StackDriver.js +0 -45
- package/src/Drivers/TelegramDriver.js +0 -46
- package/src/Exceptions/DriverExistException.js +0 -31
- package/src/Exceptions/FormatterExistException.js +0 -32
- package/src/Exceptions/NotFoundDriverException.js +0 -31
- package/src/Exceptions/NotFoundFormatterException.js +0 -31
- package/src/Exceptions/NotImplementedConfigException.js +0 -37
- package/src/Factories/DriverFactory.js +0 -128
- package/src/Factories/FormatterFactory.js +0 -77
- package/src/Formatters/CliFormatter.js +0 -24
- package/src/Formatters/Formatter.js +0 -266
- package/src/Formatters/JsonFormatter.js +0 -37
- package/src/Formatters/MessageFormatter.js +0 -26
- package/src/Formatters/RequestFormatter.js +0 -64
- package/src/Formatters/SimpleFormatter.js +0 -27
- package/src/Helpers/ColorHelper.js +0 -322
- package/src/Helpers/FactoryHelper.js +0 -31
- package/src/Helpers/VanillaLogger.js +0 -134
- package/src/index.d.ts +0 -797
- package/src/index.js +0 -180
package/src/index.d.ts
DELETED
|
@@ -1,797 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @athenna/logger
|
|
3
|
-
*
|
|
4
|
-
* (c) João Lenon <lenon@athenna.io>
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Facade } from '@athenna/ioc'
|
|
11
|
-
|
|
12
|
-
export const Log: typeof Facade & Logger
|
|
13
|
-
|
|
14
|
-
export class Driver {
|
|
15
|
-
/**
|
|
16
|
-
* Holds the configuration object itself.
|
|
17
|
-
*
|
|
18
|
-
* @type {any}
|
|
19
|
-
*/
|
|
20
|
-
configs: any
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Holds the configuration object of driver.
|
|
24
|
-
*
|
|
25
|
-
* @type {any}
|
|
26
|
-
*/
|
|
27
|
-
driverConfig: any
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Holds the formatter string value.
|
|
31
|
-
*
|
|
32
|
-
* @type {string}
|
|
33
|
-
*/
|
|
34
|
-
formatter: string
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Holds the configuration object of formatter.
|
|
38
|
-
*
|
|
39
|
-
* @type {any}
|
|
40
|
-
*/
|
|
41
|
-
formatterConfig: any
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The max log level that this driver can transport.
|
|
45
|
-
*
|
|
46
|
-
* @return {string}
|
|
47
|
-
*/
|
|
48
|
-
level: string
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The log level order to check if log could
|
|
52
|
-
* be transported or not.
|
|
53
|
-
*
|
|
54
|
-
* @type {string[]}
|
|
55
|
-
*/
|
|
56
|
-
levelOrder: string[]
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new instance of ConsoleDriver.
|
|
60
|
-
*
|
|
61
|
-
* @param {any} configs
|
|
62
|
-
* @return {Driver}
|
|
63
|
-
*/
|
|
64
|
-
constructor(configs: any)
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Transport the log.
|
|
68
|
-
*
|
|
69
|
-
* @param {string} level
|
|
70
|
-
* @param {string} message
|
|
71
|
-
* @return {any | Promise<any>}
|
|
72
|
-
*/
|
|
73
|
-
transport(level: string, message: string): any | Promise<any>
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Check if message could be transported.
|
|
77
|
-
*
|
|
78
|
-
* @param level {string}
|
|
79
|
-
* @return {boolean}
|
|
80
|
-
*/
|
|
81
|
-
couldBeTransported(level: string): boolean
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Call formatter factory to format the message.
|
|
85
|
-
*
|
|
86
|
-
* @param level {string}
|
|
87
|
-
* @param message {string}
|
|
88
|
-
* @param [clean] {boolean}
|
|
89
|
-
* @return {any}
|
|
90
|
-
*/
|
|
91
|
-
format(level: string, message: string, clean?: boolean): any
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get the stream type for level.
|
|
95
|
-
*
|
|
96
|
-
* @param level {string}
|
|
97
|
-
* @return {string}
|
|
98
|
-
*/
|
|
99
|
-
getStreamTypeFor(level: string): string
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export class Formatter {
|
|
103
|
-
/**
|
|
104
|
-
* Holds the configuration object of formatter.
|
|
105
|
-
*/
|
|
106
|
-
configs: any
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Creates a new instance of Formatter.
|
|
110
|
-
*
|
|
111
|
-
* @param {any} configs
|
|
112
|
-
* @return {Formatter}
|
|
113
|
-
*/
|
|
114
|
-
config(configs: any): Formatter
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Format the message.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} message
|
|
120
|
-
* @return {string}
|
|
121
|
-
*/
|
|
122
|
-
format(message: string): string
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Create the PID for formatter.
|
|
126
|
-
*
|
|
127
|
-
* @return {string}
|
|
128
|
-
*/
|
|
129
|
-
pid(): string
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Create the hostname for formatter.
|
|
133
|
-
*
|
|
134
|
-
* @return {string}
|
|
135
|
-
*/
|
|
136
|
-
hostname(): string
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Get the level without any color or format.
|
|
140
|
-
*
|
|
141
|
-
* @return {string}
|
|
142
|
-
*/
|
|
143
|
-
level(): string
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Get the trace id for formatter.
|
|
147
|
-
*
|
|
148
|
-
* @return {string | null}
|
|
149
|
-
*/
|
|
150
|
-
traceId(): string | null
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Create the timestamp for formatter.
|
|
154
|
-
*
|
|
155
|
-
* @return {string}
|
|
156
|
-
*/
|
|
157
|
-
timestamp(): string
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Transform the message to string.
|
|
161
|
-
*
|
|
162
|
-
* @param message {string}
|
|
163
|
-
* @return {string}
|
|
164
|
-
*/
|
|
165
|
-
toString(message: string): string
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Clean the message removing colors if clean
|
|
169
|
-
* option is true. If force is true, then colors
|
|
170
|
-
* will be removed even if configs clean option
|
|
171
|
-
* is false.
|
|
172
|
-
*
|
|
173
|
-
* @param message {string}
|
|
174
|
-
* @param [force] {boolean}
|
|
175
|
-
* @return {string}
|
|
176
|
-
*/
|
|
177
|
-
clean(message, force?: boolean): string
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Apply all colors necessary to message.
|
|
181
|
-
*
|
|
182
|
-
* @param message {string}
|
|
183
|
-
* @return {string}
|
|
184
|
-
*/
|
|
185
|
-
applyColors(message: string): string
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Apply colors in message.
|
|
189
|
-
*
|
|
190
|
-
* @param message {string}
|
|
191
|
-
* @return {string}
|
|
192
|
-
*/
|
|
193
|
-
applyColorsByChalk(message: string): string
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Apply colors in message by level.
|
|
197
|
-
*
|
|
198
|
-
* @param message {string}
|
|
199
|
-
* @return {string}
|
|
200
|
-
*/
|
|
201
|
-
applyColorsByLevel(message: string): string
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Create the cli level string.
|
|
205
|
-
*
|
|
206
|
-
* @return {string}
|
|
207
|
-
*/
|
|
208
|
-
cliLevel(): string
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Create the simple level string.
|
|
212
|
-
*
|
|
213
|
-
* @return {string}
|
|
214
|
-
*/
|
|
215
|
-
simpleLevel(): string
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Create the message level emoji string.
|
|
219
|
-
*
|
|
220
|
-
* @return {string}
|
|
221
|
-
*/
|
|
222
|
-
messageLevel(): string
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export class ColorHelper {
|
|
226
|
-
/**
|
|
227
|
-
* Chalk instance.
|
|
228
|
-
*
|
|
229
|
-
* @return {import('chalk').ChalkInstance}
|
|
230
|
-
*/
|
|
231
|
-
static chalk: import('chalk').ChalkInstance
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Paint as bold.
|
|
235
|
-
*
|
|
236
|
-
* @return {import('chalk').ChalkInstance}
|
|
237
|
-
*/
|
|
238
|
-
static get bold(): import('chalk').ChalkInstance
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Paint as purple.
|
|
242
|
-
*
|
|
243
|
-
* @return {import('chalk').ChalkInstance}
|
|
244
|
-
*/
|
|
245
|
-
static get purple(): import('chalk').ChalkInstance
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Paint as darkPurple.
|
|
249
|
-
*
|
|
250
|
-
* @return {import('chalk').ChalkInstance}
|
|
251
|
-
*/
|
|
252
|
-
static get darkPurple(): import('chalk').ChalkInstance
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Paint as yellow.
|
|
256
|
-
*
|
|
257
|
-
* @return {import('chalk').ChalkInstance}
|
|
258
|
-
*/
|
|
259
|
-
static get yellow(): import('chalk').ChalkInstance
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Paint as cyan.
|
|
263
|
-
*
|
|
264
|
-
* @return {import('chalk').ChalkInstance}
|
|
265
|
-
*/
|
|
266
|
-
static get cyan(): import('chalk').ChalkInstance
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Paint as white.
|
|
270
|
-
*
|
|
271
|
-
* @return {import('chalk').ChalkInstance}
|
|
272
|
-
*/
|
|
273
|
-
static get white(): import('chalk').ChalkInstance
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Paint as orange.
|
|
277
|
-
*
|
|
278
|
-
* @return {import('chalk').ChalkInstance}
|
|
279
|
-
*/
|
|
280
|
-
static get orange(): import('chalk').ChalkInstance
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Paint as green.
|
|
284
|
-
*
|
|
285
|
-
* @return {import('chalk').ChalkInstance}
|
|
286
|
-
*/
|
|
287
|
-
static get green(): import('chalk').ChalkInstance
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Paint as darkGreen.
|
|
291
|
-
*
|
|
292
|
-
* @return {import('chalk').ChalkInstance}
|
|
293
|
-
*/
|
|
294
|
-
static get darkGreen(): import('chalk').ChalkInstance
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Paint as red.
|
|
298
|
-
*
|
|
299
|
-
* @return {import('chalk').ChalkInstance}
|
|
300
|
-
*/
|
|
301
|
-
static get red(): import('chalk').ChalkInstance
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Paint traces.
|
|
305
|
-
*
|
|
306
|
-
* @return {import('chalk').ChalkInstance}
|
|
307
|
-
*/
|
|
308
|
-
static get trace(): import('chalk').ChalkInstance
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Paint debugs.
|
|
312
|
-
*
|
|
313
|
-
* @return {import('chalk').ChalkInstance}
|
|
314
|
-
*/
|
|
315
|
-
static get debug(): import('chalk').ChalkInstance
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Paint infos.
|
|
319
|
-
*
|
|
320
|
-
* @return {import('chalk').ChalkInstance}
|
|
321
|
-
*/
|
|
322
|
-
static get info(): import('chalk').ChalkInstance
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Paint success.
|
|
326
|
-
*
|
|
327
|
-
* @return {import('chalk').ChalkInstance}
|
|
328
|
-
*/
|
|
329
|
-
static get success(): import('chalk').ChalkInstance
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Paint warns.
|
|
333
|
-
*
|
|
334
|
-
* @return {import('chalk').ChalkInstance}
|
|
335
|
-
*/
|
|
336
|
-
static get warn(): import('chalk').ChalkInstance
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Paint errors.
|
|
340
|
-
*
|
|
341
|
-
* @return {import('chalk').ChalkInstance}
|
|
342
|
-
*/
|
|
343
|
-
static get error(): import('chalk').ChalkInstance
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Paint fatals.
|
|
347
|
-
*
|
|
348
|
-
* @return {import('chalk').ChalkInstance}
|
|
349
|
-
*/
|
|
350
|
-
static get fatal(): import('chalk').ChalkInstance
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Paint http method.
|
|
354
|
-
*
|
|
355
|
-
* @return {import('chalk').ChalkInstance}
|
|
356
|
-
*/
|
|
357
|
-
static get GET(): import('chalk').ChalkInstance
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Paint http method.
|
|
361
|
-
*
|
|
362
|
-
* @return {import('chalk').ChalkInstance}
|
|
363
|
-
*/
|
|
364
|
-
static get HEAD(): import('chalk').ChalkInstance
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Paint http method.
|
|
368
|
-
*
|
|
369
|
-
* @return {import('chalk').ChalkInstance}
|
|
370
|
-
*/
|
|
371
|
-
static get PUT(): import('chalk').ChalkInstance
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Paint http method.
|
|
375
|
-
*
|
|
376
|
-
* @return {import('chalk').ChalkInstance}
|
|
377
|
-
*/
|
|
378
|
-
static get PATCH(): import('chalk').ChalkInstance
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Paint http method.
|
|
382
|
-
*
|
|
383
|
-
* @return {import('chalk').ChalkInstance}
|
|
384
|
-
*/
|
|
385
|
-
static get POST(): import('chalk').ChalkInstance
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Paint http method.
|
|
389
|
-
*
|
|
390
|
-
* @return {import('chalk').ChalkInstance}
|
|
391
|
-
*/
|
|
392
|
-
static get DELETE(): import('chalk').ChalkInstance
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Paint http method.
|
|
396
|
-
*
|
|
397
|
-
* @return {import('chalk').ChalkInstance}
|
|
398
|
-
*/
|
|
399
|
-
static get OPTIONS(): import('chalk').ChalkInstance
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Remove all colors and special chars of string.
|
|
403
|
-
*
|
|
404
|
-
* @param {string} string
|
|
405
|
-
* @return {string}
|
|
406
|
-
*/
|
|
407
|
-
static removeColors(string: string): string
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Paint by the http method.
|
|
411
|
-
*
|
|
412
|
-
* @param {'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', 'OPTIONS', 'HEAD' } method
|
|
413
|
-
* @return {import('chalk').ChalkInstance}
|
|
414
|
-
*/
|
|
415
|
-
static httpMethod(method: any): import('chalk').ChalkInstance
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* Applies the log engine to execute chalk methods.
|
|
419
|
-
*
|
|
420
|
-
* @param {string} args
|
|
421
|
-
* @return {any}
|
|
422
|
-
*/
|
|
423
|
-
static applyLogEngine(...args): any
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
export class FactoryHelper {
|
|
427
|
-
/**
|
|
428
|
-
* Group the configuration values.
|
|
429
|
-
*
|
|
430
|
-
* @param {any} object
|
|
431
|
-
* @param {any} defaultValue
|
|
432
|
-
* @return {any}
|
|
433
|
-
*/
|
|
434
|
-
static groupConfigs(object: any, defaultValue: any): any
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export class DriverFactory {
|
|
438
|
-
/**
|
|
439
|
-
* Drivers of DriverFactory.
|
|
440
|
-
*
|
|
441
|
-
* @type {Map<string, { Driver: any }>}
|
|
442
|
-
*/
|
|
443
|
-
static drivers: Map<
|
|
444
|
-
string,
|
|
445
|
-
{
|
|
446
|
-
Driver: any
|
|
447
|
-
}
|
|
448
|
-
>
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Return an array with all available drivers.
|
|
452
|
-
*
|
|
453
|
-
* @return {any[]}
|
|
454
|
-
*/
|
|
455
|
-
static availableDrivers(): any[]
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Fabricate a new instance of a driver based on
|
|
459
|
-
* channel configurations.
|
|
460
|
-
*
|
|
461
|
-
* @param {string} channelName
|
|
462
|
-
* @param {any} runtimeConfig
|
|
463
|
-
* @return {any}
|
|
464
|
-
*/
|
|
465
|
-
static fabricate(channelName: string, runtimeConfig?: any): any
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Fabricate a new instance of a driver without
|
|
469
|
-
* configurations.
|
|
470
|
-
*
|
|
471
|
-
* @param {string} driverName
|
|
472
|
-
* @param {any} runtimeConfig
|
|
473
|
-
* @return {any}
|
|
474
|
-
*/
|
|
475
|
-
static fabricateOnly(driverName: string, runtimeConfig?: any): any
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Creates a new driver implementation.
|
|
479
|
-
*
|
|
480
|
-
* @param {string} name
|
|
481
|
-
* @param {(channel: string, configs?: any) => any} driver
|
|
482
|
-
*/
|
|
483
|
-
static createDriver(
|
|
484
|
-
name: string,
|
|
485
|
-
driver: (channel: string, configs?: any) => any,
|
|
486
|
-
): void
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
export class FormatterFactory {
|
|
490
|
-
/**
|
|
491
|
-
* Formatters of FormatterFactory.
|
|
492
|
-
*
|
|
493
|
-
* @type {Map<string, { Formatter: any }>}
|
|
494
|
-
*/
|
|
495
|
-
static formatters: Map<
|
|
496
|
-
string,
|
|
497
|
-
{
|
|
498
|
-
Formatter: any
|
|
499
|
-
}
|
|
500
|
-
>
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Return an array with all available formatters.
|
|
504
|
-
*
|
|
505
|
-
* @return {any[]}
|
|
506
|
-
*/
|
|
507
|
-
static availableFormatters(): any[]
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Fabricate a new instance of a formatter.
|
|
511
|
-
*
|
|
512
|
-
* @param {string} formatterName
|
|
513
|
-
* @return {any}
|
|
514
|
-
*/
|
|
515
|
-
static fabricate(formatterName: string): any
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Creates a new formatter implementation.
|
|
519
|
-
*
|
|
520
|
-
* @param {string} name
|
|
521
|
-
* @param {() => any} formatter
|
|
522
|
-
*/
|
|
523
|
-
static createFormatter(name: string, formatter: () => any): void
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
export class VanillaLogger {
|
|
527
|
-
/**
|
|
528
|
-
* Set runtime configurations for drivers and
|
|
529
|
-
* formatters.
|
|
530
|
-
*
|
|
531
|
-
* @param {any} runtimeConfig
|
|
532
|
-
* @return {VanillaLogger}
|
|
533
|
-
*/
|
|
534
|
-
config(runtimeConfig: any): VanillaLogger
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Change the log channel.
|
|
538
|
-
*
|
|
539
|
-
* @param {string[]} channels
|
|
540
|
-
* @return {VanillaLogger}
|
|
541
|
-
*/
|
|
542
|
-
channel(...channels: string[]): VanillaLogger
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* Creates a log of type trace in channel.
|
|
546
|
-
*
|
|
547
|
-
* @param {string|any} message
|
|
548
|
-
* @return {any | Promise<any>}
|
|
549
|
-
*/
|
|
550
|
-
trace(message: string | any): any | Promise<any>
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* Creates a log of type trace in channel.
|
|
554
|
-
*
|
|
555
|
-
* @param {string[]|any[]} args
|
|
556
|
-
* @return {any | Promise<any>}
|
|
557
|
-
*/
|
|
558
|
-
trace(...args: string[] | any[]): any | Promise<any>
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* Creates a log of type debug in channel.
|
|
562
|
-
*
|
|
563
|
-
* @param {string|any} message
|
|
564
|
-
* @return {any | Promise<any>}
|
|
565
|
-
*/
|
|
566
|
-
debug(message: string | any): any | Promise<any>
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Creates a log of type debug in channel.
|
|
570
|
-
*
|
|
571
|
-
* @param {string[]|any[]} args
|
|
572
|
-
* @return {any | Promise<any>}
|
|
573
|
-
*/
|
|
574
|
-
debug(...args: string[] | any[]): any | Promise<any>
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Creates a log of type info in channel.
|
|
578
|
-
*
|
|
579
|
-
* @param {string|any} message
|
|
580
|
-
* @return {any | Promise<any>}
|
|
581
|
-
*/
|
|
582
|
-
info(message: string | any): any | Promise<any>
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Creates a log of type info in channel.
|
|
586
|
-
*
|
|
587
|
-
* @param {string[]|any[]} args
|
|
588
|
-
* @return {any | Promise<any>}
|
|
589
|
-
*/
|
|
590
|
-
info(...args: string[] | any[]): any | Promise<any>
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Creates a log of type success in channel.
|
|
594
|
-
*
|
|
595
|
-
* @param {string|any} message
|
|
596
|
-
* @return {any | Promise<any>}
|
|
597
|
-
*/
|
|
598
|
-
success(message: string | any): any | Promise<any>
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
* Creates a log of type success in channel.
|
|
602
|
-
*
|
|
603
|
-
* @param {string[]|any[]} args
|
|
604
|
-
* @return {any | Promise<any>}
|
|
605
|
-
*/
|
|
606
|
-
success(...args: string[] | any[]): any | Promise<any>
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Creates a log of type warn in channel.
|
|
610
|
-
*
|
|
611
|
-
* @param {string|any} message
|
|
612
|
-
* @return {any | Promise<any>}
|
|
613
|
-
*/
|
|
614
|
-
warn(message: string | any): any | Promise<any>
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Creates a log of type warn in channel.
|
|
618
|
-
*
|
|
619
|
-
* @param {string[]|any[]} args
|
|
620
|
-
* @return {any | Promise<any>}
|
|
621
|
-
*/
|
|
622
|
-
warn(...args: string[] | any[]): any | Promise<any>
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Creates a log of type error in channel.
|
|
626
|
-
*
|
|
627
|
-
* @param {string|any} message
|
|
628
|
-
* @return {any | Promise<any>}
|
|
629
|
-
*/
|
|
630
|
-
error(message: string | any): any | Promise<any>
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Creates a log of type error in channel.
|
|
634
|
-
*
|
|
635
|
-
* @param {string[]|any[]} args
|
|
636
|
-
* @return {any | Promise<any>}
|
|
637
|
-
*/
|
|
638
|
-
error(...args: string[] | any[]): any | Promise<any>
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* Creates a log of type fatal in channel.
|
|
642
|
-
*
|
|
643
|
-
* @param {string|any} message
|
|
644
|
-
* @return {any | Promise<any>}
|
|
645
|
-
*/
|
|
646
|
-
fatal(message: string | any): any | Promise<any>
|
|
647
|
-
|
|
648
|
-
/**
|
|
649
|
-
* Creates a log of type fatal in channel.
|
|
650
|
-
*
|
|
651
|
-
* @param {string[]|any[]} args
|
|
652
|
-
* @return {any | Promise<any>}
|
|
653
|
-
*/
|
|
654
|
-
fatal(...args: string[] | any[]): any | Promise<any>
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
export class Logger {
|
|
658
|
-
/**
|
|
659
|
-
* Set runtime configurations for drivers and
|
|
660
|
-
* formatters.
|
|
661
|
-
*
|
|
662
|
-
* @param {any} runtimeConfig
|
|
663
|
-
* @return {Logger}
|
|
664
|
-
*/
|
|
665
|
-
config(runtimeConfig: any): Logger
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* Change the log channel.
|
|
669
|
-
*
|
|
670
|
-
* @param {string[]} channels
|
|
671
|
-
* @return {Logger}
|
|
672
|
-
*/
|
|
673
|
-
channel(...channels: string[]): Logger
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* Creates a log of type trace in channel.
|
|
677
|
-
*
|
|
678
|
-
* @param {string|any} message
|
|
679
|
-
* @return {any | Promise<any>}
|
|
680
|
-
*/
|
|
681
|
-
trace(message: string | any): any | Promise<any>
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Creates a log of type trace in channel.
|
|
685
|
-
*
|
|
686
|
-
* @param {string[]|any[]} args
|
|
687
|
-
* @return {any | Promise<any>}
|
|
688
|
-
*/
|
|
689
|
-
trace(...args: string[] | any[]): any | Promise<any>
|
|
690
|
-
|
|
691
|
-
/**
|
|
692
|
-
* Creates a log of type debug in channel.
|
|
693
|
-
*
|
|
694
|
-
* @param {string|any} message
|
|
695
|
-
* @return {any | Promise<any>}
|
|
696
|
-
*/
|
|
697
|
-
debug(message: string | any): any | Promise<any>
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Creates a log of type debug in channel.
|
|
701
|
-
*
|
|
702
|
-
* @param {string[]|any[]} args
|
|
703
|
-
* @return {any | Promise<any>}
|
|
704
|
-
*/
|
|
705
|
-
debug(...args: string[] | any[]): any | Promise<any>
|
|
706
|
-
|
|
707
|
-
/**
|
|
708
|
-
* Creates a log of type info in channel.
|
|
709
|
-
*
|
|
710
|
-
* @param {string|any} message
|
|
711
|
-
* @return {any | Promise<any>}
|
|
712
|
-
*/
|
|
713
|
-
info(message: string | any): any | Promise<any>
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Creates a log of type info in channel.
|
|
717
|
-
*
|
|
718
|
-
* @param {string[]|any[]} args
|
|
719
|
-
* @return {any | Promise<any>}
|
|
720
|
-
*/
|
|
721
|
-
info(...args: string[] | any[]): any | Promise<any>
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* Creates a log of type success in channel.
|
|
725
|
-
*
|
|
726
|
-
* @param {string|any} message
|
|
727
|
-
* @return {any | Promise<any>}
|
|
728
|
-
*/
|
|
729
|
-
success(message: string | any): any | Promise<any>
|
|
730
|
-
|
|
731
|
-
/**
|
|
732
|
-
* Creates a log of type success in channel.
|
|
733
|
-
*
|
|
734
|
-
* @param {string[]|any[]} args
|
|
735
|
-
* @return {any | Promise<any>}
|
|
736
|
-
*/
|
|
737
|
-
success(...args: string[] | any[]): any | Promise<any>
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* Creates a log of type warn in channel.
|
|
741
|
-
*
|
|
742
|
-
* @param {string|any} message
|
|
743
|
-
* @return {any | Promise<any>}
|
|
744
|
-
*/
|
|
745
|
-
warn(message: string | any): any | Promise<any>
|
|
746
|
-
|
|
747
|
-
/**
|
|
748
|
-
* Creates a log of type warn in channel.
|
|
749
|
-
*
|
|
750
|
-
* @param {string[]|any[]} args
|
|
751
|
-
* @return {any | Promise<any>}
|
|
752
|
-
*/
|
|
753
|
-
warn(...args: string[] | any[]): any | Promise<any>
|
|
754
|
-
|
|
755
|
-
/**
|
|
756
|
-
* Creates a log of type error in channel.
|
|
757
|
-
*
|
|
758
|
-
* @param {string|any} message
|
|
759
|
-
* @return {any | Promise<any>}
|
|
760
|
-
*/
|
|
761
|
-
error(message: string | any): any | Promise<any>
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Creates a log of type error in channel.
|
|
765
|
-
*
|
|
766
|
-
* @param {string[]|any[]} args
|
|
767
|
-
* @return {any | Promise<any>}
|
|
768
|
-
*/
|
|
769
|
-
error(...args: string[] | any[]): any | Promise<any>
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* Creates a log of type fatal in channel.
|
|
773
|
-
*
|
|
774
|
-
* @param {string|any} message
|
|
775
|
-
* @return {any | Promise<any>}
|
|
776
|
-
*/
|
|
777
|
-
fatal(message: string | any): any | Promise<any>
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* Creates a log of type fatal in channel.
|
|
781
|
-
*
|
|
782
|
-
* @param {string[]|any[]} args
|
|
783
|
-
* @return {any | Promise<any>}
|
|
784
|
-
*/
|
|
785
|
-
fatal(...args: string[] | any[]): any | Promise<any>
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* Get a new instance of any log driver
|
|
789
|
-
* with vanilla configurations. By default,
|
|
790
|
-
* vanilla logger will use the "console" driver
|
|
791
|
-
* and "none" formatter.
|
|
792
|
-
*
|
|
793
|
-
* @param {any} [configs]
|
|
794
|
-
* @return {VanillaLogger}
|
|
795
|
-
*/
|
|
796
|
-
static getVanillaLogger(configs?: any): VanillaLogger
|
|
797
|
-
}
|