Fix #60
This commit is contained in:
parent
51c88a4cdb
commit
114cdccaa0
|
@ -99,6 +99,8 @@ template dynamicLogScope*(bindings: varargs[untyped]) {.dirty.} =
|
|||
bindSym("activeChroniclesScope", brForceOpen),
|
||||
bindings)
|
||||
|
||||
let chroniclesBlockName {.compileTime.} = ident "chroniclesLogStmt"
|
||||
|
||||
when runtimeFilteringEnabled:
|
||||
import chronicles/topics_registry
|
||||
export setTopicState, setLogLevel, TopicState
|
||||
|
@ -127,7 +129,7 @@ when runtimeFilteringEnabled:
|
|||
|
||||
result.add quote do:
|
||||
if not `topicsMatch`(LogLevel(`logLevel`), `topicsArray`):
|
||||
break chroniclesLogStmt
|
||||
break `chroniclesBlockName`
|
||||
else:
|
||||
template runtimeFilteringDisabledError =
|
||||
{.error: "Run-time topic filtering is currently disabled. " &
|
||||
|
@ -316,7 +318,12 @@ macro logIMPL(lineInfo: static InstInfo,
|
|||
code.add newCall("logAllDynamicProperties", Stream, record)
|
||||
code.add newCall("flushRecord", record)
|
||||
|
||||
result = newBlockStmt(id"chroniclesLogStmt", code)
|
||||
result = quote do:
|
||||
try:
|
||||
block `chroniclesBlockName`:
|
||||
`code`
|
||||
except CatchableError as err:
|
||||
logLoggingFailure(cstring(`eventName`))
|
||||
|
||||
when defined(debugLogImpl):
|
||||
echo result.repr
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mode = ScriptMode.Verbose
|
||||
|
||||
packageName = "chronicles"
|
||||
version = "0.7.2"
|
||||
version = "0.8.0"
|
||||
author = "Status Research & Development GmbH"
|
||||
description = "A crafty implementation of structured logging for Nim"
|
||||
license = "Apache License 2.0"
|
||||
|
|
|
@ -158,9 +158,12 @@ template ignoreIOErrors(body: untyped) =
|
|||
try: body
|
||||
except IOError: discard
|
||||
|
||||
proc logLoggingFailure*(msg: cstring) =
|
||||
ignoreIOErrors: stderr.writeLine(msg)
|
||||
|
||||
template undeliveredMsg(reason: string, logMsg: OutStr) =
|
||||
const error = "[Chronicles] " & reason & ". Log message not delivered: "
|
||||
ignoreIOErrors stderr.writeLine(error & logMsg)
|
||||
logLoggingFailure(cstring(error & logMsg))
|
||||
|
||||
# XXX:
|
||||
# Uncomenting this leads to an error message that the Outputs tuple
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=long_lines
|
||||
program="../long_lines"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=AnsiColors
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; NativeColors on Unix will give AnsiColors
|
||||
|
||||
program=long_lines
|
||||
program="../long_lines"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=NativeColors
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; NativeColors test for Windows, actually just compares the non colored output
|
||||
program=long_lines
|
||||
program="../long_lines"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=NativeColors
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=long_lines
|
||||
program="../long_lines"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=custom_formatters
|
||||
program="../custom_formatters"
|
||||
chronicles_sinks="textlines[file(lines.txt,truncate)],textblocks[file(blocks.txt,truncate)],json[file(json.txt,truncate)]"
|
||||
chronicles_timestamps=None
|
||||
chronicles_colors=None
|
||||
|
|
|
@ -11,7 +11,7 @@ logScope:
|
|||
logScope:
|
||||
c = 100
|
||||
|
||||
proc main(arg: int) =
|
||||
proc main(arg: int) {.raises: [Defect].} =
|
||||
logScope:
|
||||
topics = "main"
|
||||
arg
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=no_side_effect
|
||||
program="../no_side_effect"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
@ -6,4 +6,4 @@ chronicles_log_level=TRACE
|
|||
|
||||
[Output]
|
||||
stdout="""TRC effect-free tid=0
|
||||
"""
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program="dynamic_scopes"
|
||||
program="../dynamic_scopes"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textblocks[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=long_lines
|
||||
program="../long_lines"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=size
|
||||
program="../size"
|
||||
max_size=1000000
|
||||
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=size
|
||||
program="../size"
|
||||
max_size=650000
|
||||
release
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program="runtime_filtering"
|
||||
program="../runtime_filtering"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_runtime_filtering="on"
|
||||
chronicles_colors=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program="runtime_filtering_no_scopes"
|
||||
program="../runtime_filtering_no_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_runtime_filtering="on"
|
||||
chronicles_colors=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[nocolors,file(mylog.txt)]"
|
||||
chronicles_timestamps=None
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[notimestamps,file(mylog.txt)]"
|
||||
chronicles_colors=None
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[file(lines.txt,truncate)],textblocks[file(blocks.txt,truncate)]"
|
||||
chronicles_timestamps=None
|
||||
chronicles_colors=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="json[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[file(lines.txt,truncate),nocolors],textblocks[file(blocks.txt,truncate),notimestamps,ansicolors]"
|
||||
|
||||
[Output]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textblocks[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[file(lines.txt,truncate)],textblocks[file(blocks.txt,truncate)],json[file(log.json,truncate)]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program="custom_stream"
|
||||
program="../custom_stream"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=file_log_stream
|
||||
program="../file_log_stream"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=runtime_path
|
||||
program="../runtime_path"
|
||||
chronicles_sinks="textlines[file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=multiple_streams
|
||||
program="../multiple_streams"
|
||||
chronicles_streams="foo[textlines],bar[textlines]"
|
||||
chronicles_colors=None
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=multiple_streams
|
||||
program="../multiple_streams"
|
||||
chronicles_streams="foo[textlines],bar[json[file]]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=multiple_streams
|
||||
program="../multiple_streams"
|
||||
chronicles_streams="foo[textlines],bar[textblocks[file]]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=multiple_streams
|
||||
program="../multiple_streams"
|
||||
chronicles_streams="foo[textlines[stdout,nocolors]],bar[textlines[file,notimestamps,ansicolors]]"
|
||||
|
||||
[Output]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=xml_stream_usage
|
||||
program="../xml_stream_usage"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=UnixTime
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=RfcTime
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=lexical_scopes
|
||||
program="../lexical_scopes"
|
||||
chronicles_sinks="textlines[stdout,file]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=UnixTime
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
program=topics_and_loglvls
|
||||
program="../topics_and_loglvls"
|
||||
chronicles_sinks="textlines[stdout]"
|
||||
chronicles_colors=None
|
||||
chronicles_timestamps=None
|
||||
|
|
Loading…
Reference in New Issue