refactor internally a little to clean up the code. Make the main example a real example so we make sure it compiles
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/natefinch/lumberjack"
|
||||
)
|
||||
@@ -25,3 +26,15 @@ func ExampleLogger_Rotate() {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// To use lumberjack with the standard library's log package, just pass it into
|
||||
// the SetOutput function when your application starts.
|
||||
func Example() {
|
||||
log.SetOutput(&lumberjack.Logger{
|
||||
Dir: "/var/log/myapp/",
|
||||
NameFormat: time.RFC822 + ".log",
|
||||
MaxSize: lumberjack.Gigabyte,
|
||||
MaxBackups: 3,
|
||||
MaxAge: lumberjack.Week * 4,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user