fix(proxyd): log initialization (#9785)

* fix(proxyd): log initialization

* update integration test as well
This commit is contained in:
felipe 2024-03-07 16:29:59 -08:00 committed by GitHub
parent f44f147313
commit 08b38db217
2 changed files with 4 additions and 4 deletions

@ -28,7 +28,7 @@ var (
func main() {
// Set up logger with a default INFO level in case we fail to parse flags.
// Otherwise the final critical log won't show what the parsing error was.
slog.SetDefault(slog.New(slog.NewJSONHandler(
log.SetDefault(log.NewLogger(slog.NewJSONHandler(
os.Stdout, &slog.HandlerOptions{Level: slog.LevelInfo})))
log.Info("starting proxyd", "version", GitVersion, "commit", GitCommit, "date", GitDate)
@ -50,7 +50,7 @@ func main() {
log.Warn("invalid server.log_level set: " + config.Server.LogLevel)
}
}
slog.SetDefault(slog.New(slog.NewJSONHandler(
log.SetDefault(log.NewLogger(slog.NewJSONHandler(
os.Stdout, &slog.HandlerOptions{Level: logLevel})))
if config.Server.EnablePprof {

@ -186,6 +186,6 @@ func (h *ProxydWSClient) WriteControlMessage(msgType int, msg []byte) error {
}
func InitLogger() {
slog.SetDefault(slog.New(
log.NewTerminalHandlerWithLevel(os.Stdout, slog.LevelDebug, false)))
log.SetDefault(log.NewLogger(slog.NewJSONHandler(
os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug})))
}