Fixes chronicles log output

This commit is contained in:
benbierens 2024-09-10 11:02:16 +02:00
parent 9433d9f7e0
commit 7da8c043e2
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
1 changed files with 12 additions and 5 deletions

View File

@ -9,11 +9,18 @@ import pkg/zip/zipfiles
import pkg/chronos/apps/http/httpclient
import ../../codex/contracts/marketplace
## TODO: chronicles is still "Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device"
## And I am mildly annoyed by this.
defaultChroniclesStream.outputs[0].writer =
proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe.} =
echo msg
proc consoleLog(logLevel: LogLevel, msg: LogOutputStr) {.gcsafe.} =
try:
stdout.write(msg)
stdout.flushFile()
except IOError as err:
logLoggingFailure(cstring(msg), err)
proc noOutput(logLevel: LogLevel, msg: LogOutputStr) = discard
defaultChroniclesStream.outputs[0].writer = consoleLog
defaultChroniclesStream.outputs[1].writer = noOutput
defaultChroniclesStream.outputs[2].writer = noOutput
proc printHelp() =
info "Usage: ./cirdl [circuitPath] [rpcEndpoint] [marketplaceAddress]"