Skip to content

message field in data record overwrites actual log message #690

Closed
@yelworc

Description

@yelworc

When a message property is included in the log data payload (ie. the first parameter of the logger call, see example below), that field overrides the actual log message (provided as the second parameter). I realize that this might be hard to "fix" – the only ugly workaround I can think of at the moment would be automatically renaming the data field to something like _message

If you consider this a user error, I think a caveat/warning in the docs would be appropriate.

Environment details

  • OS: Debian 5.10.158-2
  • Node.js version: v18.12.1
  • npm version: 8.19.2
  • @google-cloud/logging-bunyan version: 4.2.2

Steps to reproduce

  1. Log a message like this:
logger.info({ message: 'boom' }, 'this is the actual message');

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/nodejs-logging-bunyan API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions