nwaku/vendor/nim-chronicles/tests/dynamic_scopes.nim

20 lines
297 B
Nim

import chronicles
logScope:
topics = "main"
type
Seconds = distinct int
proc `$`*(t: Seconds): string = $(t.int) & "s"
proc `%`*(t: Seconds): string = $(t.int)
proc main =
dynamicLogScope(reqId = 10, userId = 20):
info "test"
warn("about to exit", timeSpent = 2.Seconds)
main()