swarm
swarm copied to clipboard
Flag for swapRotatingFileHandler filesize
Currently, the log level/logpath for swap logs are defined in the cli.
- swap-audit-loglevel
- swap-audit-logpath
Another flag should be added specifically for the purpose of defining max split size. Once this limit is reached a new log file is created, to avoid massive text files.
swap/log.go
const fileSizeLimit = 262144 // max bytes limit for splitting file in parts
// swapRotatingFileHandler returns a RotatingFileHandler this will split the logs into multiple files.
// the files are split based on the limit parameter expressed in bytes
...
func swapRotatingFileHandler(logdir string) (log.Handler, error) {
return log.RotatingFileHandler(
logdir,
fileSizeLimit,
log.JSONFormatOrderedEx(false, true),
)
}