refactor: replace .error() with .exception() logging for better debugging on sentry

This commit is contained in:
Krrish Dholakia 2024-08-16 09:22:47 -07:00
parent 1510daba4f
commit 61f4b71ef7
35 changed files with 242 additions and 253 deletions

View file

@ -82,7 +82,11 @@ class _ENTERPRISE_BannedKeywords(CustomLogger):
except HTTPException as e:
raise e
except Exception as e:
verbose_proxy_logger.error(traceback.format_exc())
verbose_proxy_logger.exception(
"litellm.enterprise.enterprise_hooks.banned_keywords::async_pre_call_hook - Exception occurred - {}".format(
str(e)
)
)
async def async_post_call_success_hook(
self,

View file

@ -118,4 +118,8 @@ class _ENTERPRISE_BlockedUserList(CustomLogger):
except HTTPException as e:
raise e
except Exception as e:
verbose_proxy_logger.error(traceback.format_exc())
verbose_proxy_logger.exception(
"litellm.enterprise.enterprise_hooks.blocked_user_list::async_pre_call_hook - Exception occurred - {}".format(
str(e)
)
)

View file

@ -92,7 +92,11 @@ class _ENTERPRISE_LLMGuard(CustomLogger):
},
)
except Exception as e:
verbose_proxy_logger.error(traceback.format_exc())
verbose_proxy_logger.exception(
"litellm.enterprise.enterprise_hooks.llm_guard::moderation_check - Exception occurred - {}".format(
str(e)
)
)
raise e
def should_proceed(self, user_api_key_dict: UserAPIKeyAuth, data: dict) -> bool: