Standard library / log/slog

slog.Value.LogValuer()

Return the LogValuer stored in a KindLogValuer value. Expected stdout: '[redacted]\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) LogValuer() LogValuer

Return Value

LogValuer

Return the LogValuer stored in a KindLogValuer value.

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
type secret string
func (s secret) LogValue() slog.Value { return slog.StringValue("[redacted]") }
func main() { v := slog.AnyValue(secret("demo")); fmt.Println(v.LogValuer().LogValue()) }
Go Reference