26 lines
319 B
Go
Raw Normal View History

2021-12-04 16:42:11 +00:00
// +build linux
package lumberjack
import (
"log"
"os"
"os/signal"
"syscall"
)
// Example of how to rotate in response to SIGHUP.
func ExampleLogger_Rotate() {
l := &Logger{}
log.SetOutput(l)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP)
go func() {
for {
<-c
l.Rotate()
}
}()
}