Skip to content

Logger improvements #84

@vlaurin

Description

@vlaurin

Ability to log custom key/value pair outside of message

For example, passing an object:

logger.info({
  message: 'The message to log',
  path: '/api/path',
  method: 'GET',
});

Should record the path and method property at the root of the log message, not serialised within the message, even though these properties are not known by the logger. This is so that when using json as the log format, this properties can be exploited in the logs.

Lazily generated log messages

logger.debug(() => `Compute-expensive log message`);

Providing a function to the logger should result in the function being executed ONLY if the targeted log level is enabled. This is so that expensive log message are only generated when they are actually needed in order to avoid impacting the performances unnecessarily. This is especially relevant for debug logs.

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