mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-17 06:04:20 +01:00
config: make log rotation configurable
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
80d57f3ddf
commit
5eed171187
4
log.go
4
log.go
@@ -116,14 +116,14 @@ var subsystemLoggers = map[string]btclog.Logger{
|
||||
// initLogRotator initializes the logging rotator to write logs to logFile and
|
||||
// create roll files in the same directory. It must be called before the
|
||||
// package-global log rotator variables are used.
|
||||
func initLogRotator(logFile string) {
|
||||
func initLogRotator(logFile string, MaxLogFileSize int, MaxLogFiles int) {
|
||||
logDir, _ := filepath.Split(logFile)
|
||||
err := os.MkdirAll(logDir, 0700)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to create log directory: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
r, err := rotator.New(logFile, 10*1024, false, 3)
|
||||
r, err := rotator.New(logFile, int64(MaxLogFileSize*1024), false, MaxLogFiles)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to create file rotator: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user