example_test.go 433 B

12345678910111213141516171819
  1. package lumberjack_test
  2. import (
  3. "log"
  4. "gopkg.in/natefinch/lumberjack.v2"
  5. )
  6. // To use lumberjack with the standard library's log package, just pass it into
  7. // the SetOutput function when your application starts.
  8. func Example() {
  9. log.SetOutput(&lumberjack.Logger{
  10. Filename: "/var/log/myapp/foo.log",
  11. MaxSize: 500, // megabytes
  12. MaxBackups: 3,
  13. MaxAge: 28, // days
  14. Compress: true, // disabled by default
  15. })
  16. }