diff --git a/chronicles.nim b/chronicles.nim index 7b184e3..8b8f46a 100644 --- a/chronicles.nim +++ b/chronicles.nim @@ -71,10 +71,16 @@ macro logScopeIMPL(prevScopes: typed, result.add chroniclesExportNode let activeScope = id("activeChroniclesScope", isPublic) - result.add quote do: - template `activeScope` {.used.} = - `newRevision` - `newAssingments` + when defined(nimHasTemplateRedefinitionPragma): + result.add quote do: + template `activeScope` {.redefine, used.} = + `newRevision` + `newAssingments` + else: + result.add quote do: + template `activeScope` {.used.} = + `newRevision` + `newAssingments` template logScope*(newBindings: untyped) {.dirty.} = bind bindSym, logScopeIMPL, brForceOpen @@ -411,4 +417,4 @@ logFn fatal , LogLevel.FATAL # * dynamic scope overrides (plus maybe an option to control the priority # between dynamic and lexical bindings) # -# * implement some of the leading standardized structured logging formats +# * implement some of the leading standardized structured logging formats \ No newline at end of file