From d75a5cbad564ad27bca420f852566c567c7ba237 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 10 Sep 2024 06:03:13 +0000 Subject: [PATCH 1/3] fix ImplicitTemplateRedefinition warning --- chronicles.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chronicles.nim b/chronicles.nim index 7b184e3..3a22f4f 100644 --- a/chronicles.nim +++ b/chronicles.nim @@ -72,7 +72,7 @@ macro logScopeIMPL(prevScopes: typed, let activeScope = id("activeChroniclesScope", isPublic) result.add quote do: - template `activeScope` {.used.} = + template `activeScope` {.redefine, used.} = `newRevision` `newAssingments` @@ -411,4 +411,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 From 1479ae05e7f504c111b0f1fd479f708efef1a7a2 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 10 Sep 2024 06:12:34 +0000 Subject: [PATCH 2/3] retain Nim 1.6 compatibility --- chronicles.nim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/chronicles.nim b/chronicles.nim index 3a22f4f..7f1aa9b 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` {.redefine, used.} = - `newRevision` - `newAssingments` + when NimMajor >= 2: + 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 From d357e28387ee506af96daa352b96292bb42a85e5 Mon Sep 17 00:00:00 2001 From: tersec Date: Wed, 11 Sep 2024 23:58:08 +0000 Subject: [PATCH 3/3] Update chronicles.nim Co-authored-by: Jacek Sieka --- chronicles.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chronicles.nim b/chronicles.nim index 7f1aa9b..8b8f46a 100644 --- a/chronicles.nim +++ b/chronicles.nim @@ -71,7 +71,7 @@ macro logScopeIMPL(prevScopes: typed, result.add chroniclesExportNode let activeScope = id("activeChroniclesScope", isPublic) - when NimMajor >= 2: + when defined(nimHasTemplateRedefinitionPragma): result.add quote do: template `activeScope` {.redefine, used.} = `newRevision`