use older logfire logging

This commit is contained in:
Ishaan Jaff 2024-06-17 19:45:22 -07:00
parent c93463b535
commit e37092aab6

View file

@ -666,7 +666,6 @@ class Logging:
end_time=end_time, end_time=end_time,
print_verbose=print_verbose, print_verbose=print_verbose,
) )
if callback == "logfire": if callback == "logfire":
global logfireLogger global logfireLogger
verbose_logger.debug("reaches logfire for success logging!") verbose_logger.debug("reaches logfire for success logging!")
@ -1473,25 +1472,6 @@ class Logging:
end_time=end_time, end_time=end_time,
print_verbose=print_verbose, print_verbose=print_verbose,
) )
if callback == "logfire":
verbose_logger.debug("reaches logfire for failure logging!")
kwargs = {}
for k, v in self.model_call_details.items():
if (
k != "original_response"
): # copy.deepcopy raises errors as this could be a coroutine
kwargs[k] = v
kwargs["exception"] = exception
logfireLogger.log_event(
kwargs=kwargs,
response_obj=result,
start_time=start_time,
end_time=end_time,
level=LogfireLevel.ERROR.value,
print_verbose=print_verbose,
)
if callback == "sentry": if callback == "sentry":
print_verbose("sending exception to sentry") print_verbose("sending exception to sentry")
if capture_exception: if capture_exception:
@ -1616,6 +1596,25 @@ class Logging:
print_verbose=print_verbose, print_verbose=print_verbose,
) )
if callback == "logfire":
verbose_logger.debug("reaches logfire for failure logging!")
kwargs = {}
for k, v in self.model_call_details.items():
if (
k != "original_response"
): # copy.deepcopy raises errors as this could be a coroutine
kwargs[k] = v
kwargs["exception"] = exception
logfireLogger.log_event(
kwargs=kwargs,
response_obj=result,
start_time=start_time,
end_time=end_time,
level=LogfireLevel.ERROR.value,
print_verbose=print_verbose,
)
except Exception as e: except Exception as e:
print_verbose( print_verbose(
f"LiteLLM.LoggingError: [Non-Blocking] Exception occurred while failure logging with integrations {str(e)}" f"LiteLLM.LoggingError: [Non-Blocking] Exception occurred while failure logging with integrations {str(e)}"