Log Levels

Control the verbosity of your logs with Logixlysia.

Logixlysia provides multiple log levels to help you control the verbosity of your logging output.

Available Levels

DEBUG

For detailed debugging information:

logixlysia({
  config: {
    logFilter: {
      level: 'DEBUG'
    }
  }
})

INFO

For general operational information:

logixlysia({
  config: {
    logFilter: {
      level: 'INFO'
    }
  }
})

WARNING

For warning messages:

logixlysia({
  config: {
    logFilter: {
      level: 'WARNING'
    }
  }
})

ERROR

For error conditions:

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

Level Hierarchy

Log levels follow a hierarchy from most to least verbose:

DEBUG > INFO > WARNING > ERROR

When you set a log level, all higher levels will also be logged. For example, setting the level to WARNING will log both WARNING and ERROR messages.

Multiple Levels

You can specify multiple levels to log:

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

Environment-based Levels

Configure different levels for different environments:

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

Best Practices

  1. Development

    • Use DEBUG level for detailed debugging
    • Log everything for troubleshooting
    • Include stack traces
  2. Staging

    • Use INFO level for normal operation
    • Log important events
    • Monitor warnings
  3. Production

    • Use WARNING level for normal operation
    • Log only important events
    • Focus on errors and warnings
  4. Monitoring

    • Set up alerts for ERROR level
    • Monitor WARNING trends
    • Review logs regularly

Example Configurations

Development Setup

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

Production Setup

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

Monitoring Setup

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

On this page