diff --git a/litellm/integrations/custom_logger.py b/litellm/integrations/custom_logger.py index cd41f5d712..d79b01cfea 100644 --- a/litellm/integrations/custom_logger.py +++ b/litellm/integrations/custom_logger.py @@ -10,11 +10,10 @@ import traceback class CustomLogger: # Class variables or attributes - def __init__(self, callback_func): - # Instance variables - self.callback_func = callback_func + def __init__(self): + pass - def log_input_event(self, model, messages, kwargs, print_verbose): + def log_input_event(self, model, messages, kwargs, print_verbose, callback_func): try: print_verbose( f"Custom Logger - Enters logging function for model {kwargs}" @@ -22,7 +21,7 @@ class CustomLogger: kwargs["model"] = model kwargs["messages"] = messages kwargs["log_event_type"] = "pre_api_call" - self.callback_func( + callback_func( kwargs, ) print_verbose( @@ -32,14 +31,14 @@ class CustomLogger: traceback.print_exc() print_verbose(f"Custom Logger Error - {traceback.format_exc()}") - def log_event(self, kwargs, response_obj, start_time, end_time, print_verbose): + def log_event(self, kwargs, response_obj, start_time, end_time, print_verbose, callback_func): # Method definition try: print_verbose( f"Custom Logger - Enters logging function for model {kwargs}" ) kwargs["log_event_type"] = "post_api_call" - self.callback_func( + callback_func( kwargs, # kwargs to func response_obj, start_time,