miolo 0.0.2 → 0.0.3
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/lib/logger/index.js +7 -3
- package/package.json +1 -1
- package/src/logger/index.js +6 -2
package/lib/logger/index.js
CHANGED
|
@@ -15,7 +15,8 @@ var {
|
|
|
15
15
|
combine,
|
|
16
16
|
timestamp,
|
|
17
17
|
_label,
|
|
18
|
-
printf
|
|
18
|
+
printf,
|
|
19
|
+
errors
|
|
19
20
|
} = format;
|
|
20
21
|
|
|
21
22
|
var init_logger = (config, emailer) => {
|
|
@@ -34,7 +35,8 @@ var init_logger = (config, emailer) => {
|
|
|
34
35
|
var tm = new Date(info.timestamp);
|
|
35
36
|
var ts = tm.toLocaleString((config === null || config === void 0 ? void 0 : (_config$format = config.format) === null || _config$format === void 0 ? void 0 : _config$format.locale) || 'en'); //const ts= tm.toString().substr(4, 20)
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
var log = "[miolo] ".concat(lc(ts), " ").concat(lc(info.level), " ").concat(info.message);
|
|
39
|
+
return info.stack ? "".concat(log, "\n").concat(info.stack) : log;
|
|
38
40
|
});
|
|
39
41
|
var _log_transports = []; //
|
|
40
42
|
// Console transport
|
|
@@ -87,7 +89,9 @@ var init_logger = (config, emailer) => {
|
|
|
87
89
|
|
|
88
90
|
var logger = createLogger({
|
|
89
91
|
level: (config === null || config === void 0 ? void 0 : config.level) || 'silly',
|
|
90
|
-
format: combine(
|
|
92
|
+
format: combine(format.errors({
|
|
93
|
+
stack: true
|
|
94
|
+
}), timestamp(), myFormat),
|
|
91
95
|
transports: _log_transports
|
|
92
96
|
});
|
|
93
97
|
return logger;
|
package/package.json
CHANGED
package/src/logger/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { LIGHT_CYAN, LIGHT_BLUE, LIGHT_GREEN, YELLOW, LIGHT_RED, RED } from 'far
|
|
|
2
2
|
/* https://github.com/winstonjs/winston/issues/925 */
|
|
3
3
|
/* https://github.com/winstonjs/winston/issues/287 */
|
|
4
4
|
const { createLogger, format, transports } = require('winston')
|
|
5
|
-
const { combine, timestamp, _label, printf } = format
|
|
5
|
+
const { combine, timestamp, _label, printf, errors } = format
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
const init_logger = (config, emailer) => {
|
|
@@ -20,7 +20,10 @@ const init_logger = (config, emailer) => {
|
|
|
20
20
|
const tm = new Date(info.timestamp)
|
|
21
21
|
const ts= tm.toLocaleString(config?.format?.locale || 'en')
|
|
22
22
|
//const ts= tm.toString().substr(4, 20)
|
|
23
|
-
|
|
23
|
+
const log= `[miolo] ${lc(ts)} ${lc(info.level)} ${info.message}`
|
|
24
|
+
return info.stack
|
|
25
|
+
? `${log}\n${info.stack}`
|
|
26
|
+
: log;
|
|
24
27
|
})
|
|
25
28
|
|
|
26
29
|
|
|
@@ -78,6 +81,7 @@ const init_logger = (config, emailer) => {
|
|
|
78
81
|
const logger = createLogger({
|
|
79
82
|
level: config?.level || 'silly',
|
|
80
83
|
format: combine(
|
|
84
|
+
format.errors({ stack: true }),
|
|
81
85
|
timestamp(),
|
|
82
86
|
myFormat
|
|
83
87
|
),
|