mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
log http panic.
This commit is contained in:
parent
7e548ec00a
commit
6026ab8a27
@ -7,7 +7,6 @@ import (
|
|||||||
|
|
||||||
"github.com/go-chi/chi/middleware"
|
"github.com/go-chi/chi/middleware"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
|
||||||
|
|
||||||
"demodesk/neko/internal/types"
|
"demodesk/neko/internal/types"
|
||||||
"demodesk/neko/internal/utils"
|
"demodesk/neko/internal/utils"
|
||||||
@ -114,10 +113,8 @@ func (e *logEntry) Write(status, bytes int, header http.Header, elapsed time.Dur
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *logEntry) Panic(v interface{}, stack []byte) {
|
func (e *logEntry) Panic(v interface{}, stack []byte) {
|
||||||
message := fmt.Sprintf("%+v", v)
|
e.logger.WithLevel(zerolog.PanicLevel).
|
||||||
|
Interface("req", e.req).
|
||||||
log.Fatal().
|
|
||||||
Str("message", message).
|
|
||||||
Str("stack", string(stack)).
|
Str("stack", string(stack)).
|
||||||
Msg("got HTTP panic")
|
Msgf("request panic (500): %+v", v)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user