fix: nim build (#333)

This commit is contained in:
dozyio
2025-11-11 15:53:19 +00:00
committed by GitHub
parent 0671a706d3
commit 1b559eedcf
2 changed files with 19 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths"
--define:
"chronicles_sinks=textblocks[dynamic]"
"chronicles_sinks=json[dynamic]"
--define:
"chronicles_log_level=DEBUG"
# end Nimble config

View File

@@ -82,6 +82,24 @@ proc start(
# Handle Ctrl+C
setControlCHook(cleanup)
# Pick the correct string type for your Chronicles version
when declared(OutStr):
type WriterStr = OutStr
else:
type WriterStr = LogOutputStr
# Early (bootstrap) writer: mirror logs to stdout so nothing is dropped
defaultChroniclesStream.output.writer =
proc (lvl: LogLevel, rec: WriterStr) {.closure, gcsafe, raises: [].} =
let s = cast[string](rec)
try:
for line in s.splitLines():
stdout.writeLine(line)
stdout.flushFile()
except IOError:
discard
var rng = newRng()
let switch =