Skip to content

Commit

Permalink
fix(proxyd): log initialization (ethereum-optimism#9785)
Browse files Browse the repository at this point in the history
* fix(proxyd): log initialization

* update integration test as well
  • Loading branch information
felipe-op authored Mar 8, 2024
1 parent f1db793 commit 713f288
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions proxyd/cmd/proxyd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions proxyd/integration_tests/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})))
}

0 comments on commit 713f288

Please sign in to comment.