logger-filter-more
Some checks failed
Deploy on push / deploy (push) Failing after 4m18s

This commit is contained in:
2025-08-31 23:53:16 +03:00
parent 3086f22c2e
commit 95b7e88f64

View File

@@ -48,10 +48,16 @@ def filter(record: logging.LogRecord) -> bool:
"GetUserDocuments", "GetUserDocuments",
"GetDrafts", "GetDrafts",
"During handling of the above exception", "During handling of the above exception",
"await gather", 'File "/usr/local/lib/python3.13/site-packages/graphql/execution/execute.py"',
"raise error", 'File "/app/services/auth.py"',
"handle_field_error",
"await_result", "await_result",
"handle_field_error",
"await gather",
"get_results",
"raise error",
"return_type, field_nodes, info, path, await result",
'raise AuthorizationError("Требуется авторизация")',
"decorated_function",
] ]
): ):
return False # Не логируем ошибки авторизации и их трейсбеки return False # Не логируем ошибки авторизации и их трейсбеки
@@ -199,10 +205,11 @@ ariadne_logger.addFilter(AriadneAuthFilter())
graphql_logger.addFilter(AriadneAuthFilter()) graphql_logger.addFilter(AriadneAuthFilter())
# Дополнительно блокируем логи на уровне модулей # Дополнительно блокируем логи на уровне модулей
for logger_name in ["ariadne.log_error", "ariadne", "graphql.execution.execute"]: for logger_name in ["ariadne.log_error", "ariadne", "graphql.execution.execute", "graphql.execution", "graphql.error"]:
extra_logger = logging.getLogger(logger_name) extra_logger = logging.getLogger(logger_name)
extra_logger.setLevel(logging.CRITICAL) extra_logger.setLevel(logging.CRITICAL)
extra_logger.addFilter(AriadneAuthFilter()) extra_logger.addFilter(AriadneAuthFilter())
extra_logger.disabled = True # Полностью отключаем этот логгер
def custom_error_formatter(error: GraphQLError, debug: bool = False) -> dict[Any, Any]: def custom_error_formatter(error: GraphQLError, debug: bool = False) -> dict[Any, Any]: