mirror of https://github.com/sirupsen/logrus.git
Fix errors in README examples
The existing examples were giving errors: ```go ./main.go:43: type logrus.JSONFormatter is not an expression ``` and ```go ./main.go:43: undefined: logrus ```
This commit is contained in:
parent
d1c2d610bd
commit
0fb63a88df
|
@ -77,7 +77,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Log as JSON instead of the default ASCII formatter.
|
// Log as JSON instead of the default ASCII formatter.
|
||||||
log.SetFormatter(logrus.JSONFormatter)
|
log.SetFormatter(new(log.JSONFormatter))
|
||||||
|
|
||||||
// Use the Airbrake hook to report errors that have Error severity or above to
|
// Use the Airbrake hook to report errors that have Error severity or above to
|
||||||
// an exception tracker. You can create custom hooks, see the Hooks section.
|
// an exception tracker. You can create custom hooks, see the Hooks section.
|
||||||
|
@ -276,10 +276,10 @@ init() {
|
||||||
// do something here to set environment depending on an environment variable
|
// do something here to set environment depending on an environment variable
|
||||||
// or command-line flag
|
// or command-line flag
|
||||||
if Environment == "production" {
|
if Environment == "production" {
|
||||||
log.SetFormatter(logrus.JSONFormatter)
|
log.SetFormatter(new(log.JSONFormatter))
|
||||||
} else {
|
} else {
|
||||||
// The TextFormatter is default, you don't actually have to do this.
|
// The TextFormatter is default, you don't actually have to do this.
|
||||||
log.SetFormatter(logrus.TextFormatter)
|
log.SetFormatter(new(log.TextFormatter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue