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:
Matt Bostock 2014-08-07 22:24:50 +01:00
parent d1c2d610bd
commit 0fb63a88df
1 changed files with 3 additions and 3 deletions

View File

@ -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))
} }
} }
``` ```