2022-10-15 15:58:23 +00:00
|
|
|
import
|
2022-11-17 08:27:26 +00:00
|
|
|
chronicles,
|
|
|
|
"."/[config, transition]
|
|
|
|
|
|
|
|
# we are using chronicles LogLevel
|
|
|
|
# instead of our LogLevel
|
|
|
|
import types except LogLevel
|
2022-10-15 15:58:23 +00:00
|
|
|
|
|
|
|
template wrapException(body) =
|
|
|
|
when wrapExceptionEnabled:
|
|
|
|
try:
|
|
|
|
body
|
|
|
|
except T8NError as e:
|
|
|
|
stderr.writeLine(e.msg)
|
|
|
|
quit(e.exitCode.int)
|
|
|
|
except:
|
|
|
|
let e = getCurrentException()
|
|
|
|
stderr.writeLine($e.name & " : " & e.msg)
|
|
|
|
quit(QuitFailure)
|
|
|
|
else:
|
|
|
|
body
|
|
|
|
|
2022-11-17 08:27:26 +00:00
|
|
|
when defined(chronicles_runtime_filtering):
|
|
|
|
proc toLogLevel(v: int): LogLevel =
|
|
|
|
case v
|
|
|
|
of 1: LogLevel.ERROR
|
|
|
|
of 2: LogLevel.WARN
|
|
|
|
of 3: LogLevel.INFO
|
|
|
|
of 4: LogLevel.DEBUG
|
|
|
|
of 5: LogLevel.TRACE
|
|
|
|
else: LogLevel.NONE
|
|
|
|
|
|
|
|
proc setVerbosity(v: int) =
|
|
|
|
let level = v.toLogLevel
|
|
|
|
setLogLevel(level)
|
|
|
|
|
2022-10-15 15:58:23 +00:00
|
|
|
proc main() =
|
|
|
|
wrapException:
|
|
|
|
let conf = T8NConf.init()
|
2022-11-17 08:27:26 +00:00
|
|
|
when defined(chronicles_runtime_filtering):
|
|
|
|
setVerbosity(conf.verbosity)
|
2022-10-15 15:58:23 +00:00
|
|
|
var ctx = TransContext()
|
|
|
|
ctx.transitionAction(conf)
|
|
|
|
|
|
|
|
main()
|