Skip to content

Commit 78d9725

Browse files
zipzap11Francisco
andauthored
hotfix: change log naming and type (#33)
* hotfix: change log naming and type --------- Co-authored-by: Francisco <francisco.francisco@kumparan.com>
1 parent 2254b7a commit 78d9725

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"time"
99
)
1010

11-
const formatPattern = `{"remote_ip": "%s", "time": "%s", "method": "%s", "uri": "%s", "protocol": "%s", "status": "%d", "bytes_out": "%d", "duration_in_ms": "%d", "latency_human": "%dms"}%s`
11+
const formatPattern = `{"remote_ip": "%s", "time": "%s", "method": "%s", "uri": "%s", "protocol": "%s", "status": "%d", "imaginary_bytes_out": %d, "imaginary_duration_in_ms": %d, "latency_human": "%s"}%s`
1212

1313
// LogRecord implements an Apache-compatible HTTP logging
1414
type LogRecord struct {
@@ -25,7 +25,7 @@ type LogRecord struct {
2525
func (r *LogRecord) Log(out io.Writer) {
2626
timeFormat := r.time.Format(time.RFC3339Nano)
2727

28-
_, _ = fmt.Fprintf(out, formatPattern, r.ip, timeFormat, r.method, r.uri, r.protocol, r.status, r.responseBytes, r.elapsedTime.Milliseconds(), r.elapsedTime.Milliseconds(), "\n")
28+
_, _ = fmt.Fprintf(out, formatPattern, r.ip, timeFormat, r.method, r.uri, r.protocol, r.status, r.responseBytes, r.elapsedTime.Milliseconds(), r.elapsedTime.String(), "\n")
2929
}
3030

3131
// Write acts like a proxy passing the given bytes buffer to the ResponseWritter

0 commit comments

Comments
 (0)