2
0

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:
Nate Finch
2014-06-16 12:55:21 -04:00
parent 03e9c77b42
commit fc6790d66f
3 changed files with 75 additions and 71 deletions
+13
View File
@@ -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,
})
}