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.
@@ -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
- return "[miolo] ".concat(lc(ts), " ").concat(lc(info.level), " ").concat(info.message);
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(timestamp(), myFormat),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "miolo",
5
5
  "main": "lib/index.js",
6
6
  "author": "Afialapis <info@afialapis.com>",
@@ -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
- return `[miolo] ${lc(ts)} ${lc(info.level)} ${info.message}`
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
  ),