status-im / nim-chronicles

A crafty implementation of structured logging for Nim.
Apache License 2.0
161 stars 20 forks source link

invalid index value for tuple subscript #119

Open moin110x opened 2 years ago

moin110x commented 2 years ago

Hi, im am trying to compile this code that i just directly copied form the documentaiton provided in the github page of this repository

defaultChroniclesStream.output.writer = proc (logLevel: LogLevel, msg: LogOutputStr) {.gcsafe.} = database.writeLogEntry(msg)

link: https://github.com/status-im/nim-chronicles#working-with-dynamic-outputs

and getting the following error during compilation:

chronicles-0.10.3\chronicles\log_output.nim(755, 74) Error: invalid index value for tuple subscript

and also i get the same error when trying to use log file

code: var config = loadConfiguration() let success = defaultChroniclesStream.output.open(config.logFile, fmAppend) info "APPLICATION STARTED"

https://github.com/status-im/nim-chronicles#working-with-file-outputs

dsrw commented 1 year ago

I ran into this when I was trying to use a dynamic writer without defining a dynamic output. Compiling with something like --define:chronicles_sinks=textblocks[dynamic] or --define:chronicles_default_output_device=dynamic will probably fix it. Replace dynamic with file for your 2nd example.