diff --git a/internal/middleware/logger.go b/internal/middleware/logger.go index 50c6a44..899dd1c 100644 --- a/internal/middleware/logger.go +++ b/internal/middleware/logger.go @@ -39,18 +39,18 @@ type LogEntry struct { } // Write constructs and writes the final log entry. -func (l *LogEntry) Write(status, bytes int, elapsed time.Duration) { +func (l *LogEntry) Write(status, totalBytes int, elapsed time.Duration) { rid := GetReqID(l.req.Context()) if rid != "" { fmt.Fprintf(l.buf, "[%s] ", rid) } - fmt.Fprintf(l.buf, "%03d | %s | %s | ", status, humanize.IBytes(uint64(bytes)), elapsed) + fmt.Fprintf(l.buf, "%03d | %s | %s | ", status, humanize.IBytes(uint64(totalBytes)), elapsed) l.buf.WriteString(l.req.Host + " | " + l.req.Method + " " + l.req.RequestURI) log.Print(l.buf.String()) } -/// Panic prints the call stack for a panic. +// Panic prints the call stack for a panic. func (l *LogEntry) Panic(v interface{}, stack []byte) { e := l.NewLogEntry(l.req).(*LogEntry) fmt.Fprintf(e.buf, "panic: %#v", v)