Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

⚡️ Speed up function `_is_debugging_on` by 45% (#13988)

codeflash-ai[bot]5dba5822f23d
diff --git a/litellm/_logging.py b/litellm/_logging.py
index 8c23994f92a..73902d2fc5a 100644
--- a/litellm/_logging.py
+++ b/litellm/_logging.py
@@ -108,6 +108,7 @@ verbose_router_logger.addHandler(handler)
verbose_proxy_logger.addHandler(handler)
verbose_logger.addHandler(handler)
+
def _suppress_loggers():
"""Suppress noisy loggers at INFO level"""
# Suppress httpx request logging at INFO level
@@ -120,6 +121,7 @@ def _suppress_loggers():
apscheduler_scheduler_logger = logging.getLogger("apscheduler.scheduler")
apscheduler_scheduler_logger.setLevel(logging.WARNING)
+
# Call the suppression function
_suppress_loggers()
@@ -187,6 +189,4 @@ def _is_debugging_on() -> bool:
"""
Returns True if debugging is on
"""
- if verbose_logger.isEnabledFor(logging.DEBUG) or set_verbose is True:
- return True
- return False
+ return verbose_logger.isEnabledFor(logging.DEBUG) or set_verbose is True