natefinch/lumberjack

Anyway to add time-stamp to initial file name and NOT just rotated logs?

daniel-res opened this issue · 1 comments

Looking to have a time-stamp on each file created (not just the rotated files). I've experiments with updating the file name formatting, such as

w := zapcore.AddSync(&lumberjack.Logger{

    Filename:   fmt.Sprintf("%s/dump-%v.log", logPath, time.Now().Format(time.RFC822)),
    MaxSize:    maxSize, 
    MaxBackups: maxBackUp,
    MaxAge:     maxAge, 
})

but it appears to affect rotated file logging

This maybe a limitation in the way openNew() calls the newname := backupName(name, l.LocalTime) .

A better enhancement would be to just accept the log file prefix instead of log file name