* log net/http with TLS and verbose only
This commit is contained in:
Jacob Brinlee 2023-03-01 12:58:14 -06:00 committed by GitHub
parent f8e21b2798
commit ebb3c8a290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -11,6 +11,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"math"
"mime"
"net"
@ -4319,3 +4320,7 @@ func (h *Handler) handlePostDataframe(w http.ResponseWriter, r *http.Request) {
return
}
}
func (h *Handler) DiscardHTTPServerLogs() {
h.server.ErrorLog = log.New(io.Discard, "", 0)
}

View file

@ -723,6 +723,13 @@ func (m *Command) setupServer() error {
return errors.Wrap(err, "new handler")
}
// ignore http server logs unless verbose logging in enabled
if uri.Scheme == "https" {
if !m.Config.Verbose {
hndlr.DiscardHTTPServerLogs()
}
}
m.httpHandler = hndlr
m.Handler = hndlr