mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-09-09 03:08:56 +02:00
feat: persist diagnostic logs with daily rotation and retention
This commit is contained in:
@@ -25,7 +25,12 @@ func main() {
|
||||
}
|
||||
|
||||
// 初始化日志(stdio 模式下使用 stderr 输出日志,避免干扰 JSON-RPC 通信)
|
||||
log := logger.New(cfg.Log.Level, "stderr")
|
||||
log := logger.New(cfg.Log.Level, "stderr", logger.DiagnosticOptions{
|
||||
Dir: cfg.Log.DiagnosticDir,
|
||||
Disabled: cfg.Log.DiagnosticDisabled,
|
||||
RetentionDays: cfg.Log.DiagnosticRetentionDays,
|
||||
})
|
||||
defer log.Sync()
|
||||
|
||||
// 创建MCP服务器
|
||||
mcpServer := mcp.NewServer(log.Logger)
|
||||
|
||||
+6
-1
@@ -101,7 +101,12 @@ func main() {
|
||||
}
|
||||
|
||||
// 初始化日志
|
||||
log := logger.New(cfg.Log.Level, cfg.Log.Output)
|
||||
log := logger.New(cfg.Log.Level, cfg.Log.Output, logger.DiagnosticOptions{
|
||||
Dir: cfg.Log.DiagnosticDir,
|
||||
Disabled: cfg.Log.DiagnosticDisabled,
|
||||
RetentionDays: cfg.Log.DiagnosticRetentionDays,
|
||||
})
|
||||
defer log.Sync()
|
||||
|
||||
// 创建可取消的根 context,用于优雅关闭
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user