Skip to content

Commit 41c58e5

Browse files
authored
Merge pull request coleam00#219 from coleam00/fix/respect-log-level-env-var
Fix LOG_LEVEL environment variable not being respected
2 parents 8743c05 + ade4397 commit 41c58e5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

python/src/server/config/logfire_config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,23 @@ def setup_logfire(
110110
if not handlers:
111111
handlers.append(logging.StreamHandler())
112112

113+
# Read LOG_LEVEL from environment
114+
log_level = os.getenv("LOG_LEVEL", "INFO").upper()
115+
113116
# Configure root logging
114117
logging.basicConfig(
115-
level=logging.INFO,
118+
level=getattr(logging, log_level, logging.INFO),
116119
format="%(asctime)s | %(name)s | %(levelname)s | %(message)s",
117120
datefmt="%Y-%m-%d %H:%M:%S",
118121
handlers=handlers,
119122
force=True,
120123
)
121124

125+
# Suppress noisy third-party library logs
126+
# These libraries log low-level details that are rarely useful
127+
logging.getLogger("hpack").setLevel(logging.WARNING)
128+
logging.getLogger("httpcore").setLevel(logging.WARNING)
129+
122130
_logfire_configured = True
123131
logging.info(
124132
f"📋 Logging configured (Logfire: {'enabled' if _logfire_enabled else 'disabled'})"

0 commit comments

Comments
 (0)