Commit Graph
8 Commits
Author SHA1 Message Date
qing aa3741b861 feat(liblogc): 统一集中式日志客户端库 + 全量迁移
新增:
- liblogc/: C++ 统一日志库 (libus_logc.so),支持 set_endpoint/set_service_name/set_level
- pymsg/pymsg/logc.py: Python 统一日志模块,基于 AsyncRpcQueue

C++ 迁移 (删除 6 份本地 LogC.hpp 副本):
- ca, gateway: <us/LogC.hpp> + set_service_name
- captcha2, confs2, smtp3: using qing::LogC + set_service_name
- core: ConfsLogC → qing::LogC (ConfsTask.cpp)
- 所有 Makefile 添加 -lus_logc

Python 迁移 (6 个 log_client.py → 4 行薄包装):
- smtp, redirect80, confs, captcha, dnfs, static
- 全部委托到 pymsg.logc.LogClient

Go (waf): 保持现状,自成体系
2026-08-10 04:51:43 +00:00
qing 01ae877673 fix(smtp): 给 LogClient 补 set_log_level 方法,修复启动崩溃
commit 9fc3542 把 set_log_level 加成模块级函数,但 smtp_v2.py:319
以 logs.set_log_level() 当实例方法调用,导致服务启动即抛
AttributeError: 'LogClient' object has no attribute 'set_log_level'。

新增 LogClient.set_log_level 委托给模块级函数,保持 logs 单例为
统一公开 API,模块级函数保留不破坏其他调用。
2026-08-10 12:26:59 +08:00
qing 9fc3542771 smtp: CLI 标准化补完(--host/--log-level/--instance + log_client 级别过滤)
- argparse 新增 --host(别名 --addr)、--log-level、--instance
- --log-level 经 logs.set_log_level() 真正订阅日志过滤
- log_client.py: 新增 _LOG_LEVELS/set_log_level()/_normalize_level() + push() 级别过滤
- 启动日志打印 instance/log-level 及配置来源说明
- services.yaml: smtp 声明 --instance 和 --log-level
- 注: SMTP 账号走 .env/ENV(密码不进 CLI),与全项目约定一致
2026-08-10 12:05:46 +08:00
qing 1b9c727e80 fix(log_client): harden background flush thread against exceptions
- Wrap _flush_loop main body in outer try/except to prevent any
  unexpected exception (network errors, serialization errors, etc.)
  from killing the background thread (which would cause unbounded
  queue growth and eventual OOM)
- Wrap _send() call in inner try/except as final safety net
- Wrap RpcClient() construction in try/except (connection failures
  during client creation were previously unhandled)
- Add _safe_json() helper: unserializable extra fields fall back to
  repr()/str() instead of raising TypeError that could kill thread
- Generate timestamp at push() (enqueue time) instead of _send() time,
  so timestamps reflect actual event time even when queue is backed up
- Replace unreliable time.sleep(0.6) in flush() with _flush_done Event
  for proper synchronization between caller and background thread
- Add _QUEUE_MAXSIZE=10000 with drop-oldest policy to prevent unbounded
  memory growth even in pathological cases
- Use put_nowait with Full handling to ensure push() never blocks
  business threads
- Sync fix to all 4 copies: confs/static/smtp/dnfs
2026-08-01 03:23:19 +08:00
qing 3f97dd92ef update 2026-07-30 21:57:04 +08:00
qing 167ef235e6 fixbug 100% cpu 2026-07-27 14:47:12 +08:00
qing 08021015b1 更新msg客户端 2026-07-27 09:21:06 +08:00
shufeng2012 6067030ae2 ✨ 添加smtp邮箱验证功能 2026-07-26 19:37:20 +08:00