web: log HTTP server errors through the provided slog logger (#461)
- web: log HTTP server errors through the provided slog logger
Serve never set http.Server.ErrorLog, so errors that net/http logs itself, such as “http: TLS handshake error from …: remote error: tls: unknown certificate”, went to the log package’s default logger as plain text. With a JSON logger this produced non-JSON lines.
Set ErrorLog to slog.NewLogLogger(logger.Handler(), slog.LevelError) when the server does not have one yet. ServeMultiple sets it before it starts the Serve goroutines, so the Serve goroutines only read ErrorLog. An ErrorLog set by the caller is kept.
Signed-off-by: Yashvardhan Thanvi yashvt9404@gmail.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Prometheus Exporter Toolkit
This is a Go library for Prometheus exporters.
This repository is meant to be used in combination with the client_golang repository. If you are instrumenting an existing Go application, client_golang is the repository you are looking for.
This repository is currently WIP and experimental.