@trojs/logger 0.5.11 → 0.5.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trojs/logger",
3
3
  "description": "Winston logger for TroJS",
4
- "version": "0.5.11",
4
+ "version": "0.5.13",
5
5
  "author": {
6
6
  "name": "Pieter Wigboldus",
7
7
  "url": "https://trojs.org/"
@@ -6,11 +6,13 @@ export default ({ winston, logger }) => {
6
6
  const jsonFormatter = winston.format.combine(
7
7
  winston.format.errors({ stack: logger?.debug ?? false }),
8
8
  winston.format((info) => {
9
- const logInfo = { ...info }
9
+ if (!info.message) {
10
+ info.message = info.message || info.toString()
11
+ }
10
12
  if (logger?.debug && info.stack) {
11
- logInfo.stacktrace = info.stack
13
+ info.stacktrace = info.stack
12
14
  }
13
- return logInfo
15
+ return info
14
16
  })(),
15
17
  winston.format(
16
18
  stackDriver({ level: logger?.level, defaultLevel })
@@ -25,6 +27,12 @@ export default ({ winston, logger }) => {
25
27
 
26
28
  const defaultFormatter = winston.format.combine(
27
29
  winston.format.errors({ stack: logger?.debug ?? false }),
30
+ winston.format((info) => {
31
+ if (!info.message && info instanceof Error) {
32
+ info.message = info.toString()
33
+ }
34
+ return info
35
+ })(),
28
36
  simpleLoggerWithStack
29
37
  )
30
38