mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(feat) use no-log to disable per request logging
This commit is contained in:
parent
ddd231a8c2
commit
0a538fe679
1 changed files with 17 additions and 2 deletions
|
@ -1281,8 +1281,13 @@ class Logging:
|
||||||
try:
|
try:
|
||||||
litellm_params = self.model_call_details.get("litellm_params", {})
|
litellm_params = self.model_call_details.get("litellm_params", {})
|
||||||
if litellm_params.get("no-log", False) == True:
|
if litellm_params.get("no-log", False) == True:
|
||||||
print_verbose("no-log request, skipping logging")
|
# proxy cost tracking cal backs should run
|
||||||
continue
|
if not (
|
||||||
|
isinstance(callback, CustomLogger)
|
||||||
|
and "_PROXY_" in callback.__class__.__name__
|
||||||
|
):
|
||||||
|
print_verbose("no-log request, skipping logging")
|
||||||
|
continue
|
||||||
if callback == "lite_debugger":
|
if callback == "lite_debugger":
|
||||||
print_verbose("reaches lite_debugger for logging!")
|
print_verbose("reaches lite_debugger for logging!")
|
||||||
print_verbose(f"liteDebuggerClient: {liteDebuggerClient}")
|
print_verbose(f"liteDebuggerClient: {liteDebuggerClient}")
|
||||||
|
@ -1711,6 +1716,16 @@ class Logging:
|
||||||
callbacks = litellm._async_success_callback
|
callbacks = litellm._async_success_callback
|
||||||
verbose_logger.debug(f"Async success callbacks: {callbacks}")
|
verbose_logger.debug(f"Async success callbacks: {callbacks}")
|
||||||
for callback in callbacks:
|
for callback in callbacks:
|
||||||
|
# check if callback can run for this request
|
||||||
|
litellm_params = self.model_call_details.get("litellm_params", {})
|
||||||
|
if litellm_params.get("no-log", False) == True:
|
||||||
|
# proxy cost tracking cal backs should run
|
||||||
|
if not (
|
||||||
|
isinstance(callback, CustomLogger)
|
||||||
|
and "_PROXY_" in callback.__class__.__name__
|
||||||
|
):
|
||||||
|
print_verbose("no-log request, skipping logging")
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
if kwargs.get("no-log", False) == True:
|
if kwargs.get("no-log", False) == True:
|
||||||
print_verbose("no-log request, skipping logging")
|
print_verbose("no-log request, skipping logging")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue