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) AttrParameters & Attributes
| Name | Type | Description |
|---|---|---|
| key | string | Attribute key. |
| value | int64 | Input 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) }