Enhance logging configuration by introducing file output options and rotation settings in config.dev.toml. Update logger implementation to support multiple output streams, including file logging with rotation using lumberjack. Improve error handling and logging across various components, ensuring consistent logging practices. Update .gitignore to include log files and compressed logs. Add new Go module dependency for lumberjack.

This commit is contained in:
windyboy
2025-11-17 12:58:40 +08:00
parent 204217015d
commit 67abd66fa3
12 changed files with 326 additions and 31 deletions
+19
View File
@@ -50,6 +50,25 @@ monitor_interval = "30s"
[log]
level = "info"
format = "console"
output = ["stdout", "file"]
file = "logs/caatsm.log"
# File rotation settings
max_size = 100 # MB
max_backups = 7 # Keep 7 rotated files
max_age = 30 # Keep logs for 30 days
compress = true # Compress old log files
# Advanced options
disable_caller = false
disable_stacktrace = false
development = false
# Sampling configuration (optional, for high-volume scenarios)
# [log.sampling]
# initial = 100 # Log first 100 messages
# thereafter = 100 # Then log every 100th message
# tick = "1s" # Per second
[telemetry]
enabled = true