[Fix] Initialize customLogger in failure handlers to ensure callbacks fire
The sync and async failure handlers guarded plain-function callbacks with `customLogger is not None`, but customLogger was only initialized in the success handler path. If a request failed without any prior success in the process, the failure callback was silently skipped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
40d4e79a00
commit
86dd36e12a
@ -3000,9 +3000,10 @@ class Logging(LiteLLMLoggingBaseClass):
|
||||
litellm_call_id=self.model_call_details["litellm_call_id"],
|
||||
print_verbose=print_verbose,
|
||||
)
|
||||
if (
|
||||
callable(callback) and customLogger is not None
|
||||
): # custom logger functions
|
||||
if callable(callback): # custom logger functions
|
||||
global customLogger
|
||||
if customLogger is None:
|
||||
customLogger = CustomLogger()
|
||||
customLogger.log_event(
|
||||
kwargs=self.model_call_details,
|
||||
response_obj=result,
|
||||
@ -3143,9 +3144,10 @@ class Logging(LiteLLMLoggingBaseClass):
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
) # type: ignore
|
||||
if (
|
||||
callable(callback) and customLogger is not None
|
||||
): # custom logger functions
|
||||
if callable(callback): # custom logger functions
|
||||
global customLogger
|
||||
if customLogger is None:
|
||||
customLogger = CustomLogger()
|
||||
await customLogger.async_log_event(
|
||||
kwargs=self.model_call_details,
|
||||
response_obj=result,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user