The LogLevel enum controls the verbosity of logging output from the Daily Python SDK. It allows you to configure how much diagnostic information is printed during SDK operations, which is useful for debugging, monitoring, and troubleshooting.Log levels follow a standard hierarchy where each level includes all messages from less verbose levels. For example, setting LogLevel.Info will also show Warn and Error messages.
Maximum verbosity - Logs extremely detailed trace information including internal SDK operations. Use only when debugging specific low-level issues. Produces very high output volume.
You can change the log level after initialization using Daily.set_log_level():
from daily import Daily, LogLevel# Start with no loggingDaily.init(log_level=LogLevel.Off)# Later, enable debug loggingDaily.set_log_level(LogLevel.Debug)# Perform some operations with debug loggingclient = CallClient()client.join(meeting_url)# Reduce logging verbosityDaily.set_log_level(LogLevel.Error)
Use different log levels for development and production:
import osfrom daily import Daily, LogLevel# Check if running in productionis_production = os.getenv("ENVIRONMENT") == "production"# Use Error logging in production, Info in developmentlog_level = LogLevel.Error if is_production else LogLevel.InfoDaily.init(log_level=log_level)
Enable detailed logging only when troubleshooting:
from daily import Daily, LogLevel# Start with minimal loggingDaily.init(log_level=LogLevel.Error)# ... application code ...# When investigating an issue, temporarily increase verbositydef troubleshoot_connection_issue(): Daily.set_log_level(LogLevel.Debug) # Perform operations to debug client.join(meeting_url) # Return to normal logging Daily.set_log_level(LogLevel.Error)
Start Verbose, Then Reduce: When developing a new feature, start with LogLevel.Info or LogLevel.Debug to understand SDK behavior, then reduce to LogLevel.Error or LogLevel.Off for production.
Performance Considerations: Higher log levels (Debug and Trace) can impact performance due to increased I/O operations. Use them judiciously in production environments.
Trace Level Output: LogLevel.Trace produces extremely high volumes of output and can significantly impact performance. Only use it for short debugging sessions on specific issues.
Log output is written to standard output (stdout) and standard error (stderr). Configure your application’s logging infrastructure to capture and route these messages appropriately.