@athenna/logger 1.0.0 → 1.0.1
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 +1 -1
- package/src/Logger.js +36 -0
package/package.json
CHANGED
package/src/Logger.js
CHANGED
|
@@ -32,6 +32,12 @@ class Logger {
|
|
|
32
32
|
}
|
|
33
33
|
async log(message, options) {
|
|
34
34
|
options = Object.assign({}, { context: 'Logger' }, options);
|
|
35
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
36
|
+
options = {
|
|
37
|
+
...options,
|
|
38
|
+
...this.runtimeConfig.formatter,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
35
41
|
await this.driver.transport(message, options);
|
|
36
42
|
}
|
|
37
43
|
async info(message, options) {
|
|
@@ -39,6 +45,12 @@ class Logger {
|
|
|
39
45
|
options.level = 'INFO';
|
|
40
46
|
options.color = Color_1.Color.cyan;
|
|
41
47
|
options.streamType = 'stdout';
|
|
48
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
49
|
+
options = {
|
|
50
|
+
...options,
|
|
51
|
+
...this.runtimeConfig.formatter,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
42
54
|
await this.driver.transport(message, options);
|
|
43
55
|
}
|
|
44
56
|
async warn(message, options) {
|
|
@@ -46,6 +58,12 @@ class Logger {
|
|
|
46
58
|
options.level = 'WARN';
|
|
47
59
|
options.color = Color_1.Color.orange;
|
|
48
60
|
options.streamType = 'stdout';
|
|
61
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
62
|
+
options = {
|
|
63
|
+
...options,
|
|
64
|
+
...this.runtimeConfig.formatter,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
49
67
|
await this.driver.transport(message, options);
|
|
50
68
|
}
|
|
51
69
|
async error(message, options) {
|
|
@@ -53,6 +71,12 @@ class Logger {
|
|
|
53
71
|
options.level = 'ERROR';
|
|
54
72
|
options.color = Color_1.Color.red;
|
|
55
73
|
options.streamType = 'stderr';
|
|
74
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
75
|
+
options = {
|
|
76
|
+
...options,
|
|
77
|
+
...this.runtimeConfig.formatter,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
56
80
|
await this.driver.transport(message, options);
|
|
57
81
|
}
|
|
58
82
|
async debug(message, options) {
|
|
@@ -60,6 +84,12 @@ class Logger {
|
|
|
60
84
|
options.level = 'DEBUG';
|
|
61
85
|
options.color = Color_1.Color.purple;
|
|
62
86
|
options.streamType = 'stdout';
|
|
87
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
88
|
+
options = {
|
|
89
|
+
...options,
|
|
90
|
+
...this.runtimeConfig.formatter,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
63
93
|
await this.driver.transport(message, options);
|
|
64
94
|
}
|
|
65
95
|
async success(message, options) {
|
|
@@ -67,6 +97,12 @@ class Logger {
|
|
|
67
97
|
options.level = 'SUCCESS';
|
|
68
98
|
options.color = Color_1.Color.green;
|
|
69
99
|
options.streamType = 'stdout';
|
|
100
|
+
if (this.runtimeConfig && this.runtimeConfig.formatter) {
|
|
101
|
+
options = {
|
|
102
|
+
...options,
|
|
103
|
+
...this.runtimeConfig.formatter,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
70
106
|
await this.driver.transport(message, options);
|
|
71
107
|
}
|
|
72
108
|
}
|