Log Levels
Control log verbosity
Control the verbosity of your logging output with Logixlysia’s log level system.
Available Levels
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.
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: Use
DEBUGfor detailed debugging - Staging: Use
INFOfor normal operation - Production: Use
WARNINGorERRORfor normal operation - Monitoring: Set up alerts for
ERRORlevel
Example Configurations
Development
logFilter: {
level: ['DEBUG', 'INFO', 'WARNING', 'ERROR']
}
Production
logFilter: {
level: ['WARNING', 'ERROR']
}
Monitoring
logFilter: {
level: ['ERROR']
}