Skip to content

Child loggers, RequestId, Secrets masking and more

Choose a tag to compare

@terehov terehov released this 20 Jun 23:33
· 525 commits to master since this release

This is a jam-packed release 🎉

Don't underestimate this minor version jump, it's only due to semver and its backward compatibility reasons. ;-).

  • Child Loggers: Use getChildLogger to create a child logger based on the current instance, inherit all its settings including prefixes, and overwrite the ones you would like to change in this child. Makes it possible to follow a request all the way down (s. below requestId)
  • Runtime settings changes: Use setSettings() to change settings during runtime. Changes will also propagate to every potential child logger but can also be overwritten along the way. Prefixes will be enhanced instead of overwritten.
  • requestId: Use async_hooks (e.g. AsyncLocalStorage) to follow a request all the way down the promise chain (Example: Display all logs from Server down to DB)
  • Mask secrets: Use maskValuesOfKeys & maskStrings to prevent tslog from printing secrets and sensitive information like passwords, secrets, api keys and Authorization Bearer
  • Prefix: prefix Prefix every log message with additional attributes that are also inherited to child loggers
  • Types: displayTypes: true Display types for all variables passed to tslog, eg. string: test number: 123