Use litellm logging convention

This commit is contained in:
Frank Colson 2023-12-05 22:28:23 -07:00
parent fc31221b8a
commit 95e5331090
3 changed files with 8 additions and 3 deletions

View file

@ -2,6 +2,7 @@
import threading, requests
from typing import Callable, List, Optional, Dict, Union, Any
from litellm.caching import Cache
from litellm._logging import set_verbose
import httpx
input_callback: List[Union[str, Callable]] = []
@ -11,7 +12,6 @@ callbacks: List[Callable] = []
_async_success_callback: List[Callable] = [] # internal variable - async custom callbacks are routed here.
pre_call_rules: List[Callable] = []
post_call_rules: List[Callable] = []
set_verbose = False
email: Optional[
str
] = None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648

5
litellm/_logging.py Normal file
View file

@ -0,0 +1,5 @@
set_verbose = False
def print_verbose(print_statement):
if set_verbose:
print(print_statement)

View file

@ -4,7 +4,7 @@ from typing import Optional
import litellm
import logging
from concurrent.futures import ThreadPoolExecutor
from litellm._logging import print_verbose
logger = logging.getLogger(__name__)
@ -47,7 +47,7 @@ async def _perform_health_check(model_list: list):
try:
await litellm.acompletion(**model_params)
except Exception as e:
logger.exception("Health check failed for model %s", model_params["model"])
print_verbose(f"Health check failed for model {model_params['model']}. Error: {e}")
return False
return True