diff --git a/internal/chi/log_formatter.go b/internal/chi/log_formatter.go index cd57c0d..3a6c3c2 100644 --- a/internal/chi/log_formatter.go +++ b/internal/chi/log_formatter.go @@ -2,7 +2,6 @@ package chi import ( "context" - "fmt" "net/http" "time" @@ -37,12 +36,19 @@ type LogEntry struct { // Panic implements middleware.LogEntry func (e *LogEntry) Panic(v interface{}, stack []byte) { - logger.Error(e.ctx, fmt.Sprintf("%s %s", e.method, e.path), logger.F("stack", string(stack))) + logger.Error( + e.ctx, "http panic", + logger.F("stack", string(stack)), + logger.F("host", e.host), + logger.F("method", e.method), + logger.F("path", e.path), + ) } // Write implements middleware.LogEntry func (e *LogEntry) Write(status int, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { - logger.Info(e.ctx, fmt.Sprintf("%s %s - %d", e.method, e.path, status), + logger.Info( + e.ctx, "http request", logger.F("host", e.host), logger.F("status", status), logger.F("bytes", bytes),