Skip to content

Commit 5465d83

Browse files
committed
Move access log to debug
1 parent 0fcf7f3 commit 5465d83

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

init_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ func TestNewBaseLocator(t *testing.T) {
7474
assert.Equal(t, `{"error":"request panicked"}`+"\n", rw.Body.String())
7575

7676
logs := "[" + strings.ReplaceAll(log.String(), "\n", ",\n") + "{}]"
77-
assertjson.Equal(t, []byte(`[{"level":"info","@timestamp":"<ignore-diff>","message":"http request started","client.ip":"","user_agent.original":"","url.original":"/test/something-public","http.request.method":"GET"},
78-
{"level":"error","@timestamp":"<ignore-diff>","message":"request panicked","panic":"oops","stack":"<ignore-diff>","client.ip":"","user_agent.original":"","url.original":"/test/something-public","http.request.method":"GET"},
77+
assertjson.Equal(t, []byte(`[{"level":"error","@timestamp":"<ignore-diff>","message":"request panicked","panic":"oops","stack":"<ignore-diff>","client.ip":"","user_agent.original":"","url.original":"/test/something-public","http.request.method":"GET"},
7978
{}]`), []byte(logs), logs)
8079

8180
l.Shutdown()

log/http.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ func (mw HTTPRecover) Middleware() func(handler http.Handler) http.Handler {
133133
fields.HTTPMethod, r.Method,
134134
)
135135

136-
logger.Info(ctx, "http request started")
137-
logger.Debug(ctx, "http request headers", "headers", headersMap(r.Header))
136+
logger.Debug(ctx, "http request started", "headers", headersMap(r.Header))
138137

139138
w := middleware.NewWrapResponseWriter(rw, r.ProtoMajor)
140139
start := time.Now()
@@ -148,8 +147,7 @@ func (mw HTTPRecover) Middleware() func(handler http.Handler) http.Handler {
148147
"elapsed_ms", float64(elapsed.Nanoseconds())/1000000.0,
149148
)
150149

151-
logger.Debug(ctx, "http response headers", "headers", headersMap(w.Header()))
152-
logger.Info(ctx, "http request complete")
150+
logger.Debug(ctx, "http request complete", "resp_headers", headersMap(w.Header()))
153151
})
154152
}
155153
}

0 commit comments

Comments
 (0)