mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(feat) Custom_logger add async success & async failure
This commit is contained in:
parent
e8e6e32509
commit
e56e7d1d16
1 changed files with 6 additions and 21 deletions
|
@ -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):
|
def log_failure_event(self, kwargs, response_obj, start_time, end_time):
|
||||||
pass
|
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
|
#### 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:
|
except:
|
||||||
# traceback.print_exc()
|
# traceback.print_exc()
|
||||||
print_verbose(f"Custom Logger Error - {traceback.format_exc()}")
|
print_verbose(f"Custom Logger Error - {traceback.format_exc()}")
|
||||||
pass
|
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
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue