Log Levels
Categorize your logs by severity to optimize alerting, simplify search, and manage storage costs.
Hierarchy of Levels
LuminaLog supports five standard log levels. Choosing the correct level for each log entry is crucial for effective observability and noise reduction.
FATAL
Level 5Critical errors that mean the application cannot continue running or perform its primary function.
ERROR
Level 4Serious issues that need to be investigated, but the application can still continue to function (e.g., a specific request failed).
WARN
Level 3Potential issues or unexpected behavior that isn't currently an error but should be monitored (e.g., slow database query).
INFO
Level 2General information about application progress. The default level for production (e.g., 'User logged in', 'Service started').
DEBUG
Level 1Detailed information for debugging purposes. Should usually be disabled in production to save costs and reduce noise.
Choosing a Level
Best Practices
- • Use INFO for major state changes or business events
- • Reserve ERROR for issues requiring human intervention
- • Use WARN for symptoms that might lead to an error
- • DEBUG should provide value during local development
Common Mistakes
- • Logging everything as INFO (creates too much noise)
- • Forgetting to switch from DEBUG to INFO in production
- • Using ERROR for expected validation failures
- • Missing metadata on WARN/ERROR logs
Environment Filtering
We recommend setting your minimum log level based on the environment. In development, you'll want DEBUG, but in production, starting at INFO is best.
const logger = new LuminaLog({
apiKey: process.env.LUMINALOG_API_KEY!,
// Set minimum level based on environment
level: process.env.NODE_ENV === 'production' ? 'info' : 'debug'
});