mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
exclude healthcheck from logs.
This commit is contained in:
parent
c2d2557704
commit
6bd46b438e
@ -17,6 +17,11 @@ type logFormatter struct {
|
||||
}
|
||||
|
||||
func (l *logFormatter) NewLogEntry(r *http.Request) middleware.LogEntry {
|
||||
// exclude healthcheck from logs
|
||||
if r.RequestURI == "/api/health" {
|
||||
return &nulllog{}
|
||||
}
|
||||
|
||||
req := map[string]interface{}{}
|
||||
|
||||
if reqID := middleware.GetReqID(r.Context()); reqID != "" {
|
||||
@ -120,3 +125,11 @@ func (e *logEntry) Write(status, bytes int, header http.Header, elapsed time.Dur
|
||||
|
||||
logger.Debug().Msgf("request complete (%d)", status)
|
||||
}
|
||||
|
||||
type nulllog struct{}
|
||||
|
||||
func (e *nulllog) Panic(v interface{}, stack []byte) {}
|
||||
func (e *nulllog) Error(err error) {}
|
||||
func (e *nulllog) SetSession(session types.Session) {}
|
||||
func (e *nulllog) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user