2
0
Files
lumberjack/rotate_test.go
T
Tim Potter 3cfd7a4e74 Update rotate_test.go to use v2 of project
Hi there.  I thought it would be nice for the rotate example to use v2 of the package.
2016-01-25 15:19:09 +11:00

28 lines
374 B
Go

// +build linux
package lumberjack_test
import (
"log"
"os"
"os/signal"
"syscall"
"github.com/natefinch/lumberjack.v2"
)
// Example of how to rotate in response to SIGHUP.
func ExampleLogger_Rotate() {
l := &lumberjack.Logger{}
log.SetOutput(l)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP)
go func() {
for {
<-c
l.Rotate()
}
}()
}