modules 子系统已完成去历史化,当前仅保留可维护的核心能力。
formatter:属性格式化链multi:Fanout多路分发output/net:通用 TCP/UDP 输出(codec 可扩展)syslog:CEE 前缀输出(codec 可扩展)webhook:HTTP 输出(codec + transport)
模块统一通过 modules.RegisterFactory 注册,通过 modules.CreateModule 创建,最终通过:
logger := slog.Default().Use(module)- 不再保留旧
Converter兼容路径 - 不再保留反射式 formatter 适配分支
- 新扩展统一走强类型接口与可测试的最小抽象
模块内的 RunAsync 使用有界队列 + worker 池,默认配置为:
WorkerCount=4QueueSize=256
可在运行时调整:
modules.SetAsyncExecutorOptions(modules.AsyncExecutorOptions{
WorkerCount: 8,
QueueSize: 1024,
})读取当前配置:
opts := modules.GetAsyncExecutorOptions()队列满时采用 non-blocking 丢弃策略,不阻塞日志主链路。