@athenna/logger 3.0.6 → 3.0.7
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/package.json +7 -5
- package/src/index.d.ts +16 -8
- package/src/index.js +24 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/logger",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "The Athenna logging solution. Log in stdout, files and buckets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"telegraf": "4.7.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@athenna/common": "3.0.
|
|
55
|
-
"@athenna/config": "3.0.
|
|
56
|
-
"@athenna/ioc": "3.0.
|
|
54
|
+
"@athenna/common": "3.0.2",
|
|
55
|
+
"@athenna/config": "3.0.4",
|
|
56
|
+
"@athenna/ioc": "3.0.2",
|
|
57
57
|
"@japa/assert": "1.3.4",
|
|
58
58
|
"@japa/run-failed-tests": "1.0.7",
|
|
59
59
|
"@japa/runner": "2.0.7",
|
|
@@ -135,8 +135,10 @@
|
|
|
135
135
|
"node": true
|
|
136
136
|
},
|
|
137
137
|
"globals": {
|
|
138
|
+
"ioc": true,
|
|
138
139
|
"Env": true,
|
|
139
|
-
"
|
|
140
|
+
"Path": true,
|
|
141
|
+
"Config": true
|
|
140
142
|
},
|
|
141
143
|
"plugins": [
|
|
142
144
|
"prettier"
|
package/src/index.d.ts
CHANGED
|
@@ -622,14 +622,6 @@ export class ConsoleLogger {
|
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
export class Logger {
|
|
625
|
-
/**
|
|
626
|
-
* Get a new instance of the ConsoleLogger.
|
|
627
|
-
*
|
|
628
|
-
* @param {any} [runtimeConfigs]
|
|
629
|
-
* @return {ConsoleLogger}
|
|
630
|
-
*/
|
|
631
|
-
static getConsoleLogger(runtimeConfigs?: any): ConsoleLogger
|
|
632
|
-
|
|
633
625
|
/**
|
|
634
626
|
* Set runtime configurations for drivers and
|
|
635
627
|
* formatters.
|
|
@@ -742,4 +734,20 @@ export class Logger {
|
|
|
742
734
|
* @return {any | Promise<any>}
|
|
743
735
|
*/
|
|
744
736
|
error(...args: string[] | any[]): any | Promise<any>
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Get a new instance of the ConsoleLogger.
|
|
740
|
+
*
|
|
741
|
+
* @param {any} [runtimeConfigs]
|
|
742
|
+
* @return {ConsoleLogger}
|
|
743
|
+
*/
|
|
744
|
+
getConsoleLogger(runtimeConfigs?: any): ConsoleLogger
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Get a new instance of the ConsoleLogger.
|
|
748
|
+
*
|
|
749
|
+
* @param {any} [runtimeConfigs]
|
|
750
|
+
* @return {ConsoleLogger}
|
|
751
|
+
*/
|
|
752
|
+
static getConsoleLogger(runtimeConfigs?: any): ConsoleLogger
|
|
745
753
|
}
|
package/src/index.js
CHANGED
|
@@ -24,16 +24,6 @@ export * from './Factories/DriverFactory.js'
|
|
|
24
24
|
export * from './Factories/FormatterFactory.js'
|
|
25
25
|
|
|
26
26
|
export class Logger {
|
|
27
|
-
/**
|
|
28
|
-
* Get a new instance of the ConsoleLogger.
|
|
29
|
-
*
|
|
30
|
-
* @param {any} [runtimeConfigs]
|
|
31
|
-
* @return {ConsoleLogger}
|
|
32
|
-
*/
|
|
33
|
-
static getConsoleLogger(runtimeConfigs) {
|
|
34
|
-
return new ConsoleLogger(runtimeConfigs)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
27
|
/**
|
|
38
28
|
* The driver responsible for transporting the logs.
|
|
39
29
|
*
|
|
@@ -54,6 +44,10 @@ export class Logger {
|
|
|
54
44
|
* @return {Logger}
|
|
55
45
|
*/
|
|
56
46
|
constructor() {
|
|
47
|
+
if (!Config.exists(`logging.channels.${Config.get('logging.default')}`)) {
|
|
48
|
+
return this
|
|
49
|
+
}
|
|
50
|
+
|
|
57
51
|
this.#drivers.push(DriverFactory.fabricate('default', this.#runtimeConfigs))
|
|
58
52
|
}
|
|
59
53
|
|
|
@@ -170,4 +164,24 @@ export class Logger {
|
|
|
170
164
|
fatal(...args) {
|
|
171
165
|
return this.#log('fatal', ...args)
|
|
172
166
|
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get a new instance of the ConsoleLogger.
|
|
170
|
+
*
|
|
171
|
+
* @param {any} [runtimeConfigs]
|
|
172
|
+
* @return {ConsoleLogger}
|
|
173
|
+
*/
|
|
174
|
+
getConsoleLogger(runtimeConfigs) {
|
|
175
|
+
return Logger.getConsoleLogger(runtimeConfigs)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get a new instance of the ConsoleLogger.
|
|
180
|
+
*
|
|
181
|
+
* @param {any} [runtimeConfigs]
|
|
182
|
+
* @return {ConsoleLogger}
|
|
183
|
+
*/
|
|
184
|
+
static getConsoleLogger(runtimeConfigs) {
|
|
185
|
+
return new ConsoleLogger(runtimeConfigs)
|
|
186
|
+
}
|
|
173
187
|
}
|