Error logging
This commit is contained in:
parent
b5158adb51
commit
9b54f63eb1
5 changed files with 60 additions and 22 deletions
|
@ -3,6 +3,7 @@ package server
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"heckel.io/ntfy/log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -23,6 +24,14 @@ func (e errHTTP) JSON() string {
|
|||
return string(b)
|
||||
}
|
||||
|
||||
func (e errHTTP) Context() log.Context {
|
||||
return log.Context{
|
||||
"error": e.Message,
|
||||
"error_code": e.Code,
|
||||
"http_status": e.HTTPCode,
|
||||
}
|
||||
}
|
||||
|
||||
func wrapErrHTTP(err *errHTTP, message string, args ...any) *errHTTP {
|
||||
return &errHTTP{
|
||||
Code: err.Code,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue