forked from mirror/logrus
readme: remove error
This commit is contained in:
parent
8fe53025b6
commit
e155f76d1b
18
README.md
18
README.md
|
@ -48,24 +48,6 @@ log.AddHook("error", func(entry logrus.Entry) {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Errors
|
|
||||||
|
|
||||||
You can also use Logrus to return errors with fields. For instance:
|
|
||||||
|
|
||||||
```go
|
|
||||||
err := record.Destroy()
|
|
||||||
if err != nil {
|
|
||||||
return log.WithFields(&logrus.Fields{
|
|
||||||
"id": record.Id,
|
|
||||||
"method": "destroy"
|
|
||||||
}).AsError("Failed to destroy record")
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Will return a `logrus.Error` object. Passing it to
|
|
||||||
`log.{Info,Warn,Error,Fatal,Panic}` will log it according to the formatter set
|
|
||||||
for the environment.
|
|
||||||
|
|
||||||
#### Level logging
|
#### Level logging
|
||||||
|
|
||||||
Logrus has six levels: Debug, Info, Warning, Error, Fatal and Panic.
|
Logrus has six levels: Debug, Info, Warning, Error, Fatal and Panic.
|
||||||
|
|
Loading…
Reference in New Issue