File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ const myFormat = combine(
12
12
splat ( ) ,
13
13
printf ( ( obj ) => {
14
14
obj . localTimestamp = new Date ( ) . toISOString ( )
15
+ // Prevent errors and other objects to be inserted as Objects into message field
16
+ if ( typeof obj . message === 'object' ) {
17
+ if ( obj . message instanceof Error ) {
18
+ const errorObj = obj . message
19
+ obj . message = errorObj . message
20
+ obj . details = errorObj
21
+ } else {
22
+ obj . message = JSON . stringify ( obj . message )
23
+ }
24
+ }
15
25
return JSON . stringify ( obj ) // make single line
16
26
} )
17
27
)
Original file line number Diff line number Diff line change @@ -12,6 +12,16 @@ const myFormat = combine(
12
12
splat ( ) ,
13
13
printf ( ( obj ) => {
14
14
obj . localTimestamp = new Date ( ) . toISOString ( )
15
+ // Prevent errors and other objects to be inserted as Objects into message field
16
+ if ( typeof obj . message === 'object' ) {
17
+ if ( obj . message instanceof Error ) {
18
+ const errorObj = obj . message
19
+ obj . message = errorObj . message
20
+ obj . details = errorObj
21
+ } else {
22
+ obj . message = JSON . stringify ( obj . message )
23
+ }
24
+ }
15
25
return JSON . stringify ( obj ) // make single line
16
26
} )
17
27
)
You can’t perform that action at this time.
0 commit comments