Skip to main content

โš™๏ธ Configuration

By default the logger will output pretty logs to the console. The test runner overrides this to NOOP, but there are more options under the hood.

Level Overridesโ€‹

Override logging on a per-service / module level.

MY_APP.bootstrap({
configuration: {
boilerplate: {
LOG_LEVEL: "info"
}
},
loggerOptions: {
levelOverrides: {
boilerplate: "silent",
hass: "silent",
my_app: {
evil_logic: "trace"
}
}
}
});

In this example, your app will have a default LOG_LEVEL of info (unless overridden by an environment file).

  • hass & boilerplate is permanently muted
  • my_app follows configuration for all services
    • evil_logic always emits trace logs

Merge Dataโ€‹

Use when you need to add keys to ALL logs, for when multiple applications worth of logs are being sent to central collection.

MY_APP.bootstrap({
loggerOptions: {
mergeData: {
service: "Hard Coded Value",
}
}
});

Timestamp Formatโ€‹

default: ddd HH:mm:ss.SSS

Prettyโ€‹

Set to false to disable pretty formatting logic

MSโ€‹

Emit logs with a "ms since last log" data point

Counterโ€‹

Add a logIdx constantly incrementing counter to each log

ALSโ€‹

Enable logging AsyncLocalStorage hooks