Standard library / log/slog

slog.LevelVar.Set()

Change the minimum level atomically. Expected stdout: 'DEBUG\n'.

Formal Syntax & Structure

go syntaxgo
func (v *LevelVar) Set(l Level)

Parameters & Attributes

NameTypeDescription
lLevelInput to the operation as described above.

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
func main() { var l slog.LevelVar; l.Set(slog.LevelDebug); fmt.Println(l.Level()) }
Go Reference