Log Levels Reference

Standardized log level definitions and usage across LogFlux

Log Levels Reference

LogFlux uses a standardized 8-level logging system based on RFC 5424 (Syslog), providing clear severity classification for all log messages.

Standard Log Levels

Level Value Constant Description When to Use
Emergency 0 LEVEL_EMERGENCY System is unusable System panic, kernel errors, critical hardware failures
Alert 1 LEVEL_ALERT Action must be taken immediately Database corruption, security breaches, service unavailable
Critical 2 LEVEL_CRITICAL Critical conditions Application crashes, resource exhaustion, dependency failures
Error 3 LEVEL_ERROR Error conditions Handled exceptions, failed operations, validation errors
Warning 4 LEVEL_WARNING Warning conditions Deprecated features, performance issues, recoverable errors
Notice 5 LEVEL_NOTICE Normal but significant conditions Configuration changes, user authentication, state transitions
Info 6 LEVEL_INFO Informational messages Application startup, feature usage, successful operations
Debug 7 LEVEL_DEBUG Debug-level messages Variable values, execution flow, detailed diagnostics

Level Selection Guidelines

Emergency (0) - System Unusable

- Complete system failure
- Kernel panics or hardware failures  
- Services completely down
- Data center outages

Alert (1) - Immediate Action Required

- Security incidents requiring immediate response
- Data corruption detected
- Critical services failing
- SLA breaches imminent

Critical (2) - Critical Application Issues

- Application crashes or hangs
- Database connection failures
- Memory or disk space exhaustion
- Core functionality unavailable

Error (3) - Error Conditions

- Handled exceptions and errors
- Failed API calls or operations
- Invalid user input or data
- Recoverable application errors

Warning (4) - Potential Issues

- Performance degradation
- Deprecated feature usage
- Resource usage approaching limits
- Temporary failures with retry

Notice (5) - Significant Normal Events

- User login/logout events
- Configuration changes
- Service start/stop events
- Important state changes

Info (6) - General Information

- Application startup/shutdown
- Feature usage tracking
- Successful operations
- Business logic milestones

Debug (7) - Detailed Diagnostics

- Variable values and state
- Method entry/exit points
- Detailed execution flow
- Development troubleshooting

Best Practices

Level Usage

  1. Production Filtering: Typically filter at Info level or higher for production
  2. Development: Use Debug level for detailed troubleshooting
  3. Monitoring: Focus on Warning level and above for alerts
  4. Escalation: Error and above levels should trigger notifications

Message Content

  • Be Specific: Include relevant context and identifiers
  • Be Actionable: Provide enough information for resolution
  • Be Consistent: Use similar language for similar events
  • Include Metadata: Add structured data for filtering and analysis

Performance Considerations

  • Debug Overhead: Debug logging can impact performance significantly
  • Structured Logging: Use structured formats (JSON) for better parsing
  • Sampling: Consider sampling high-volume debug logs
  • Lazy Evaluation: Only format messages when they will be logged

Language-Specific Constants

Go SDK

1
2
3
4
5
6
7
8
logflux.LEVEL_EMERGENCY  // 0
logflux.LEVEL_ALERT      // 1
logflux.LEVEL_CRITICAL   // 2
logflux.LEVEL_ERROR      // 3
logflux.LEVEL_WARNING    // 4
logflux.LEVEL_NOTICE     // 5
logflux.LEVEL_INFO       // 6
logflux.LEVEL_DEBUG      // 7

JavaScript SDK

1
2
3
4
5
6
7
8
logflux.LEVEL_EMERGENCY  // 0
logflux.LEVEL_ALERT      // 1
logflux.LEVEL_CRITICAL   // 2
logflux.LEVEL_ERROR      // 3
logflux.LEVEL_WARNING    // 4
logflux.LEVEL_NOTICE     // 5
logflux.LEVEL_INFO       // 6
logflux.LEVEL_DEBUG      // 7

Python SDK

1
2
3
4
5
6
7
8
logflux.LEVEL_EMERGENCY  # 0
logflux.LEVEL_ALERT      # 1
logflux.LEVEL_CRITICAL   # 2
logflux.LEVEL_ERROR      # 3
logflux.LEVEL_WARNING    # 4
logflux.LEVEL_NOTICE     # 5
logflux.LEVEL_INFO       # 6
logflux.LEVEL_DEBUG      # 7

Java SDK

1
2
3
4
5
6
7
8
LogFlux.LEVEL_EMERGENCY  // 0
LogFlux.LEVEL_ALERT      // 1
LogFlux.LEVEL_CRITICAL   // 2
LogFlux.LEVEL_ERROR      // 3
LogFlux.LEVEL_WARNING    // 4
LogFlux.LEVEL_NOTICE     // 5
LogFlux.LEVEL_INFO       // 6
LogFlux.LEVEL_DEBUG      // 7

CLI Inspector

1
2
3
4
5
6
7
8
--level emergency  # 0
--level alert      # 1
--level critical   # 2
--level error      # 3
--level warning    # 4
--level notice     # 5
--level info       # 6
--level debug      # 7