Standard library / log/slog

slog.Value.Group()

Return the represented Group value; typed accessors require the appropriate Kind (String and Any have broader behavior). Expected stdout: '[n=2]\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Group() []Attr

Return Value

[]Attr

Return the represented Group value; typed accessors require the appropriate Kind (String and Any have broader behavior).

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
func main() { fmt.Println(slog.GroupValue(slog.Int("n", 2)).Group()) }
Go Reference