Skip to content

Commit

Permalink
Merge pull request #17 from rsabhilash/fix_rotatelogs_example
Browse files Browse the repository at this point in the history
Updated rotatelog example
  • Loading branch information
rifflock committed Apr 11, 2017
2 parents 1ae9178 + becf357 commit 2adb3e0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Expand Up @@ -38,12 +38,11 @@ In combination with pakages like [go-file-rotatelogs](https://github.com/lestrra

path := "/var/log/go.log"
writer := rotatelogs.NewRotateLogs(
path + ".%Y%m%d%H%M", // rotation pattern
path + ".%Y%m%d%H%M",
rotatelogs.WithLinkName(path),
rotatelogs.WithMaxAge(time.Duration(86400) * time.Second),
rotatelogs.WithRotationTime(time.Duration(604800) * time.Second),
)
writer.LinkName = path
writer.RotationTime = time.Duration(86400) * time.Second // rotate once a day
writer.MaxAge = time.Duration(604800) * time.Second // keep one week of log files
writer.Offset = 0

log.Hooks.Add(lfshook.NewHook(lfshook.WriterMap{
logrus.InfoLevel: writer,
Expand Down

0 comments on commit 2adb3e0

Please sign in to comment.