YuNing's Thought

Home

❯

Notes

❯

Go Log

Go Log

Dec 30, 20251 min read

Change Level

lvl := new(slog.LevelVar)
lvl.Set(slog.LevelInfo)
 
logger := slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
    Level: lvl,
}))
 
// later ...
lvl.Set(slog.LevelDebug)

Links

  • Structured Logging with slog - The Go Programming Language

Graph View

  • Change Level
  • Links

Backlinks

  • Logging

Created with Quartz v4.5.2 © 2025

  • GitHub
  • Discord Community