Skip to content

Meta data doesn't get passed to info object after the update #1381

@teneon

Description

@teneon

Please tell us about your environment:

  • _winston version: "^3.0.0",
    • winston@2
    • winston@3
  • _node -v outputs: v9.8.0
  • Operating System? (Linux)

What is the problem?

After updating to the latest version of Winston, 2 days ago, meta data is not added to the info object anymore in some cases!

EXAMPLE 1 (This one works fine!!):
If you log meta data like this, meta becomes part of 'message' object, so it seems to work fine.
logger.error('This is a test', { number: 123 });

'console.log' of the 'info' object looks like this:

{ number: 123,
  level: '\u001b[31merror\u001b[39m',
  message: 'This is a test',
  timestamp: '2018-06-28T09:42:04.036Z',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: [ { number: 123 } ],
  [Symbol(message)]: '{"number":123,"level":"error","message":"This is a test"}' }

EXAMPLE 2 (This one doesn't seem to work properly!!):
If there is an additional argument included ( in this case 'first' ), meta data becomes an empty array in the info object and also it is not anywhere else in the 'message' object at all.
logger.error('This is a test %s', 'first', { number: 123 });

'console.log' of the 'info' object looks like this:

{ level: '\u001b[31merror\u001b[39m',
  message: 'This is a test first',
  timestamp: '2018-06-28T09:48:46.616Z',
  meta: [],
  [Symbol(level)]: 'error',
  [Symbol(splat)]: [ 'first' ],
  [Symbol(message)]: '{"level":"error","message":"This is a test %s"}' }

What do you expect to happen instead?

As you can see, meta data doesn't exist in the 'info' object at all, so there is no way to access it and print it to the console or to log it into the file or anything. This used to work fine before i updated winston npm package 2 days ago.

Thanks for the good work guys, the project is amazing!
Best regards!

Metadata

Metadata

Assignees

Labels

FormatsApplies to the implementation of FormatsMetadataApplies to Metadata behaviorNeeds Investigation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions