@trojs/logger 0.5.12 → 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.12",
4
+ "version": "0.5.13",
5
5
  "author": {
6
6
  "name": "Pieter Wigboldus",
7
7
  "url": "https://trojs.org/"
@@ -6,6 +6,9 @@ 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
+ if (!info.message) {
10
+ info.message = info.message || info.toString()
11
+ }
9
12
  if (logger?.debug && info.stack) {
10
13
  info.stacktrace = info.stack
11
14
  }
@@ -24,6 +27,12 @@ export default ({ winston, logger }) => {
24
27
 
25
28
  const defaultFormatter = winston.format.combine(
26
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
+ })(),
27
36
  simpleLoggerWithStack
28
37
  )
29
38