(feat) Custom_logger add async success & async failure

This commit is contained in:
ishaan-jaff 2023-12-06 17:13:39 -08:00
parent 1bac052eca
commit b482b9002c

View file

@ -28,6 +28,11 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callback
def log_failure_event(self, kwargs, response_obj, start_time, end_time):
pass
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
pass
async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time):
pass
#### SINGLE-USE #### - https://docs.litellm.ai/docs/observability/custom_callback#using-your-custom-callback-function
@ -80,24 +85,4 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callback
except:
# traceback.print_exc()
print_verbose(f"Custom Logger Error - {traceback.format_exc()}")
pass
async def async_log_failure_event(self, kwargs, response_obj, start_time, end_time, print_verbose, callback_func):
# Method definition
try:
kwargs["log_event_type"] = "post_api_call"
await callback_func(
kwargs, # kwargs to func
response_obj,
start_time,
end_time,
)
print_verbose(
f"Custom Logger - final response object: {response_obj}"
)
except:
# traceback.print_exc()
print_verbose(f"Custom Logger Error - {traceback.format_exc()}")
pass
pass