mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(feat) proxy: use custom_logger
This commit is contained in:
parent
f2625bca24
commit
b1bd799be8
2 changed files with 22 additions and 0 deletions
19
litellm/proxy/custom_logger.py
Normal file
19
litellm/proxy/custom_logger.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from litellm.integrations.custom_logger import CustomLogger
|
||||
class MyCustomHandler(CustomLogger):
|
||||
def log_pre_api_call(self, model, messages, kwargs):
|
||||
print(f"Pre-API Call")
|
||||
|
||||
def log_post_api_call(self, kwargs, response_obj, start_time, end_time):
|
||||
# log: key, user, model, prompt, response, tokens, cost
|
||||
print(f"Post-API Call")
|
||||
|
||||
def log_stream_event(self, kwargs, response_obj, start_time, end_time):
|
||||
print(f"On Stream")
|
||||
|
||||
def log_success_event(self, kwargs, response_obj, start_time, end_time):
|
||||
print(f"On Success")
|
||||
|
||||
def log_failure_event(self, kwargs, response_obj, start_time, end_time):
|
||||
print(f"On Failure")
|
||||
|
||||
customHandler = MyCustomHandler()
|
Loading…
Add table
Add a link
Reference in a new issue