mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
refactor: remove duck typing
This commit is contained in:
parent
b1598c04c7
commit
0089e784b4
@ -39,9 +39,8 @@ class LoggingEvent {
|
||||
serialise() {
|
||||
return flatted.stringify(this, (key, value) => {
|
||||
// JSON.stringify(new Error('test')) returns {}, which is not really useful for us.
|
||||
// The following allows us to serialize errors correctly.
|
||||
// duck-typing for Error object
|
||||
if (value && value.message && value.stack) {
|
||||
// The following allows us to serialize errors (semi) correctly.
|
||||
if (value instanceof Error) {
|
||||
// eslint-disable-next-line prefer-object-spread
|
||||
value = Object.assign(
|
||||
{ message: value.message, stack: value.stack },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user