File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 3333ENV_AUTO_CONFIG = os .getenv ("LOG_AUTO_CONFIG" , "true" ).lower () in {"1" , "true" , "yes" }
3434ENV_DEBUG_LLM = os .getenv ("DEBUG_LLM" , "False" ).lower () in ["true" , "1" , "yes" ]
3535
36+
37+ def _configure_litellm_logger (level : int ) -> None :
38+ """Force LiteLLM library loggers to a specific level regardless of root level."""
39+ for name in ("LiteLLM" , "litellm" ):
40+ logging .getLogger (name ).setLevel (level )
41+
42+
3643# Configure litellm logging based on DEBUG_LLM
44+ _ENABLE_LITELLM_DEBUG = False
3745if ENV_DEBUG_LLM :
3846 confirmation = input (
3947 "\n ⚠️ WARNING: You are enabling DEBUG_LLM which may expose sensitive information like API keys.\n "
4048 "This should NEVER be enabled in production.\n "
4149 "Type 'y' to confirm you understand the risks: "
4250 )
4351 if confirmation .lower () == "y" :
52+ _ENABLE_LITELLM_DEBUG = True
4453 litellm .suppress_debug_info = False
4554 litellm .set_verbose = True # type: ignore
4655 else :
5160 litellm .suppress_debug_info = True
5261 litellm .set_verbose = False # type: ignore
5362
63+ # By default, suppress LiteLLM INFO/DEBUG logs regardless of root logger level
64+ _configure_litellm_logger (logging .DEBUG if _ENABLE_LITELLM_DEBUG else logging .WARNING )
65+
5466
5567# ========= SETUP =========
5668def setup_logging (
You can’t perform that action at this time.
0 commit comments