GPQBot
16 строк · 562.0 Байт
1from pybotx import Bot, IncomingMessage, IncomingMessageHandlerFunc2from pybotx_smart_logger.wrapper import wrap_smart_logger3
4from app.loggers.log_formatters import format_raw_command5from app.settings import settings6
7
8async def smart_logger_middleware(9message: IncomingMessage, bot: Bot, call_next: IncomingMessageHandlerFunc10) -> None:11async with wrap_smart_logger(12log_source="Incoming message",13context_func=lambda: format_raw_command(message.raw_command),14debug=settings.DEBUG,15):16await call_next(message, bot)