fix: restore manager info logs
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
username = user.username or ""
|
||||
first_name = user.first_name or ""
|
||||
text = msg.text
|
||||
logger.debug(f"💬 聊天消息 [{username or first_name or user.id}]: {text[:80]}")
|
||||
logger.info(f"💬 聊天消息 [{username or first_name or user.id}]: {text[:120]}")
|
||||
|
||||
# === 防刷屏 ===
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
+3
-3
@@ -24,8 +24,8 @@ app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="stat
|
||||
# SSE
|
||||
_sse_queues: list[asyncio.Queue] = []
|
||||
_log_buffer: list[dict] = []
|
||||
MAX_LOG_BUFFER = 120
|
||||
MAX_LOG_MESSAGE_CHARS = 320
|
||||
MAX_LOG_BUFFER = 300
|
||||
MAX_LOG_MESSAGE_CHARS = 1200
|
||||
|
||||
|
||||
def compact_log_message(record: logging.LogRecord) -> str:
|
||||
@@ -63,7 +63,7 @@ def install_log_handler():
|
||||
if any(isinstance(h, SSELogHandler) for h in logger.handlers):
|
||||
return
|
||||
handler = SSELogHandler()
|
||||
handler.setLevel(logging.WARNING)
|
||||
handler.setLevel(logging.INFO)
|
||||
handler.setFormatter(logging.Formatter("%(message)s"))
|
||||
logger.addHandler(handler)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user