You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the splat formatter, handling of message properties in meta objects is different than without. Although the docs are technically correct in both cases, it seems weird that the behavior is different with and without splat.
Without splat, docs say meta objects are handled as follows (link):
NOTE: any { message } property in a meta object provided will automatically be concatenated to any msg already provided: For example the below will concatenate 'world' onto 'hello':
With splat, docs say meta objects are handled as follows (link):
Any additional splat parameters beyond those needed for the % tokens (aka "metas") are assumed to be objects. Their enumerable properties are merged into the info.
What version of Logform presents the issue?
v2.4.2
What version of Node are you using?
v14.16.1
If this worked in a previous version of Logform, which was it?
EDIT: strangely, this problem doesn't occur with regular Error objects, even with splat (maybe because Error's properties are not enumerable?):
// boilerplate same as "with splat" from above
logger.error('msg1', new Error('msg2'))
// outputs:
// {"level":"error","message":"msg1 msg2","stack":"Error: msg2 ..." }
The problem
When using the splat formatter, handling of
message
properties inmeta
objects is different than without. Although the docs are technically correct in both cases, it seems weird that the behavior is different with and without splat.Without splat, docs say meta objects are handled as follows (link):
With splat, docs say meta objects are handled as follows (link):
What version of Logform presents the issue?
v2.4.2
What version of Node are you using?
v14.16.1
If this worked in a previous version of Logform, which was it?
No response
Minimum Working Example
With splat
Without splat
EDIT: strangely, this problem doesn't occur with regular
Error
objects, even with splat (maybe becauseError
's properties are not enumerable?):Additional information
Maybe applicable to winstonjs/winston#2072
🔎 Search Terms
splat format message
The text was updated successfully, but these errors were encountered: