Add note to readme and a test case
This commit is contained in:
parent
bd2edb8e86
commit
e4de3a9001
|
@ -510,6 +510,13 @@ defaultChroniclesStream.output.writer =
|
|||
database.writeLogEntry(msg)
|
||||
```
|
||||
|
||||
## Using Chronicles with `{.noSideEffect.}`
|
||||
|
||||
Usage of Chronicles from `noSideEffect` procs (or `func`) is limited to the
|
||||
`trace` statement. Normal logging can be considered a side effect, but `trace`
|
||||
is meant as a debugging aid. It's analogous to Nim's `debugEcho`, which also
|
||||
bypasses the effect system.
|
||||
|
||||
## Teaching Chronicles about your types
|
||||
|
||||
Chronicles can output log records in any of the formats supported by the Nim
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
program=no_side_effect
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
chronicles_log_level=TRACE
|
||||
|
||||
[Output]
|
||||
stdout="""TRC effect-free tid=0
|
||||
"""
|
|
@ -0,0 +1,6 @@
|
|||
import chronicles
|
||||
|
||||
func main =
|
||||
trace "effect-free"
|
||||
|
||||
main()
|
Loading…
Reference in New Issue