Skip to content

Commit

Permalink
Other type
Browse files Browse the repository at this point in the history
  • Loading branch information
rifflock committed Feb 27, 2018
1 parent 1fdc019 commit bf53994
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -23,7 +23,7 @@ func NewLogger() *logrus.Logger {
logrus.ErrorLevel: "/var/log/error.log",
}


Log = logrus.New()
Log.Hooks.Add(lfshook.NewHook(
pathMap,
&logrus.JSONFormatter{},
Expand All @@ -39,7 +39,7 @@ If no formatter is provided via `lfshook.NewHook`, a default text formatter will

### Log rotation
In order to enable automatic log rotation it's possible to provide an io.Writer instead of the path string of a log file.
In combination with pakages like [go-file-rotatelogs](https://github.com/lestrrat/go-file-rotatelogs) log rotation can easily be achieved.
In combination with packages like [go-file-rotatelogs](https://github.com/lestrrat/go-file-rotatelogs) log rotation can easily be achieved.

```go
package main
Expand All @@ -58,7 +58,7 @@ func NewLogger() *logrus.Logger {
}

path := "/var/log/go.log"
writer := rotatelogs.NewRotateLogs(
writer := rotatelogs.New(
path+".%Y%m%d%H%M",
rotatelogs.WithLinkName(path),
rotatelogs.WithMaxAge(time.Duration(86400)*time.Second),
Expand Down

0 comments on commit bf53994

Please sign in to comment.