Standard library / log/slog

slog.Int64()

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

Formal Syntax & Structure

go syntaxgo
func Int64(key string, value int64) Attr

Parameters & Attributes

NameTypeDescription
keystringAttribute key.
valueint64Input to the operation as described above.

Return Value

Attr

Construct a keyed Int64 attribute for structured logging.

Working Example

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