Skip to content

Logging

Logging

The monitor uses structured logging with configurable output formats:

Console Logging (Development)

configure_monitor(log_to_file=False)  # Logs to console with readable format

File Logging (Production)

configure_monitor(
    log_to_file=True,
    log_file_path="/var/log/myapp/monitor.log"
)  # Logs to file in JSON format

Custom Log Levels

@monitor_function(log_level="DEBUG")
def debug_function():
    pass

@monitor_function(log_level="ERROR")  # Only log errors
def critical_function():
    pass