Fix LOG_LEVEL environment variable not being respected
- Read LOG_LEVEL from environment with INFO as default - Use getattr to safely convert string to logging level constant - Supports DEBUG, INFO, WARNING, ERROR, CRITICAL levels - Falls back to INFO if invalid level specified This minimal change allows debug logs to appear when LOG_LEVEL=DEBUG is set in the .env file, fixing the issue where debug messages were being filtered out.
This commit is contained in:
parent
ad1b8bf70f
commit
e9a19ffb41
@ -110,9 +110,12 @@ def setup_logfire(
|
||||
if not handlers:
|
||||
handlers.append(logging.StreamHandler())
|
||||
|
||||
# Read LOG_LEVEL from environment
|
||||
log_level = os.getenv("LOG_LEVEL", "INFO").upper()
|
||||
|
||||
# Configure root logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
level=getattr(logging, log_level, logging.INFO),
|
||||
format="%(asctime)s | %(name)s | %(levelname)s | %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
handlers=handlers,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user