Standard library / log/slog
slog.Value.Duration()
Return the represented Duration value; typed accessors require the appropriate Kind (String and Any have broader behavior). Expected stdout: '1s\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Duration() time.DurationReturn Value
time.Duration
Return the represented Duration value; typed accessors require the appropriate Kind (String and Any have broader behavior).
Working Example
Example Snippetgo
package main
import ( "fmt" "log/slog" "time")
func main() { fmt.Println(slog.DurationValue(time.Second).Duration()) }