Standard library / log/slog

slog.Attr.String()

Return the diagnostic string form key=value, not a full structured record. Expected stdout: 'n=2\n'.

Formal Syntax & Structure

go syntaxgo
func (a Attr) String() string

Return Value

string

Return the diagnostic string form key=value, not a full structured record.

Working Example

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