mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-04-04 13:47:36 +03:00
Error logging
This commit is contained in:
parent
b5158adb51
commit
9b54f63eb1
5 changed files with 60 additions and 22 deletions
|
@ -77,7 +77,11 @@ func (e *Event) Time(time time.Time) *Event {
|
|||
|
||||
// Err adds an "error" field to the log event
|
||||
func (e *Event) Err(err error) *Event {
|
||||
e.fields[errorField] = err.Error()
|
||||
if c, ok := err.(Contexter); ok {
|
||||
e.Fields(c.Context())
|
||||
} else {
|
||||
e.fields[errorField] = err.Error()
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue