Skip to content
Logixlysia
Esc
↑↓navigate↵open⌘Jpreview
On this page

Log Levels

Control log verbosity

Control the verbosity of your logging output with Logixlysia’s log level system.

A request’s line takes its level from the final status the client got, including a status set with set.status before a throw or by a later onError hook: 5xx is ERROR, 4xx is WARNING, anything else is INFO. The exception is a thrown error, other than a status() result, that reached the client as a 2xx or 3xx, such as a body that failed after the headers went out: it is still an ERROR line.

Available Levels

Logixlysia has four log levels, from most to least verbose:

DEBUG > INFO > WARNING > ERROR

logFilter.level is the list of levels to keep. It is not a minimum level, so ['WARNING'] keeps WARNING lines and drops ERROR lines. List every level you want.

Configuration

Single Level

logixlysia({
  config: {
    logFilter: {
      level: ['ERROR']
    }
  }
})

Multiple Levels

logixlysia({
  config: {
    logFilter: {
      level: ['INFO', 'ERROR']
    }
  }
})

Environment-based

logixlysia({
  config: {
    logFilter: {
      level:
        process.env.NODE_ENV === 'production'
          ? ['ERROR', 'WARNING']
          : ['DEBUG', 'INFO', 'WARNING', 'ERROR']
    }
  }
})

Pino Log Levels

When using Pino integration, you can also configure Pino’s log levels:

logixlysia({
  config: {
    pino: {
      level: 'debug' // 'fatal', 'error', 'warn', 'info', 'debug', 'trace'
    }
  }
})

Best Practices

  • Development: keep all four levels
  • Staging: keep INFO, WARNING, and ERROR
  • Production: keep WARNING and ERROR
  • Monitoring: keep ERROR and alert on it

Example Configurations

Development

logFilter: {
  level: ['DEBUG', 'INFO', 'WARNING', 'ERROR']
}

Production

logFilter: {
  level: ['WARNING', 'ERROR']
}

Monitoring

logFilter: {
  level: ['ERROR']
}

Was this page helpful?