Skip to content

Commit

Permalink
Revert "Avoid data loss with conflictig 'msg' values. (#876)"
Browse files Browse the repository at this point in the history
This reverts commit d5a1322.
  • Loading branch information
jsumners authored Jul 31, 2020
1 parent 3338013 commit f8bf228
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ The `message` parameter takes precedence over the `mergedObject`.
That is, if a `mergedObject` contains a `msg` property, and a `message` parameter
is supplied in addition, the `msg` property in the output log will be the value of
the `message` parameter not the value of the `msg` property on the `mergedObject`.
In case this conflict occurs, the `msg` property from the object will be preserved
in the key `originalMsg`.

The `messageKey` option can be used at instantiation time to change the namespace
from `msg` to another string as preferred.
Expand Down
4 changes: 0 additions & 4 deletions lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ function asJson (obj, msg, num, time) {
obj = formatters.log(obj)
}
if (msg !== undefined) {
// If msg appears as a string and in the object, preserve it as "originalMsg"
if (obj[messageKey] !== undefined) {
obj.originalMsg = obj[messageKey]
}
obj[messageKey] = msg
}
const wildcardStringifier = stringifiers[wildcardFirstSym]
Expand Down
1 change: 0 additions & 1 deletion test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function levelTest (name, level) {
hostname,
level,
msg: 'string',
originalMsg: 'object',
hello: 'world'
})
})
Expand Down

0 comments on commit f8bf228

Please sign in to comment.