Standard library / log/slog

slog.Uint64()

Construct a keyed Uint64 attribute for structured logging. Expected stdout: 'key\n2\n'.

Formal Syntax & Structure

go syntaxgo
func Uint64(key string, v uint64) Attr

Parameters & Attributes

NameTypeDescription
keystringAttribute key.
vuint64Values to log or convert.

Return Value

Attr

Construct a keyed Uint64 attribute for structured logging.

Working Example

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