Standard library / log/slog

slog.Attr

A key and a Value representing one structured attribute. Expected stdout: 'n=2\n'.

Formal Syntax & Structure

go syntaxgo
type Attr struct {  Key   string  Value Value}

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
func main() { a := slog.Attr{Key: "n", Value: slog.IntValue(2)}; fmt.Println(a) }
Go Reference