Skip to content

logger.info({message:...}) modifies original object #1775

@PanAeon

Description

@PanAeon

Problem description:

const data = {'message':'hello'}
logger.log(data)
// now data contains "level":"info"

.info(), and probably other methods modify original object when the object contains 'message' field.
This is unfortunate because a user might be unaware of such behaviour, and can easily overlook this moment, which would lead to hard-to-find problems.

Possible fix:

Leave everything as it is (as user expect to pass config object to the logging method), but clone incoming object.

  • winston version - (3.2.1)
  • platform: all
  • languages: all

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions