From 7e1671b26e2eb642e3557391e5115578f7493089 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Fri, 18 Jul 2025 10:25:25 -0500 Subject: [PATCH] Allow inclusion of Exceptions in warn convenience templates. --- namespaced_logging.nimble | 2 +- src/namespaced_logging.nim | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/namespaced_logging.nimble b/namespaced_logging.nimble index 7588a84..cd777e5 100644 --- a/namespaced_logging.nimble +++ b/namespaced_logging.nimble @@ -1,6 +1,6 @@ # Package -version = "2.1.0" +version = "2.1.1" author = "Jonathan Bernard" description = "Wrapper around std/logging to provide namespaced logging." license = "MIT" diff --git a/src/namespaced_logging.nim b/src/namespaced_logging.nim index a5c2de2..92195a1 100644 --- a/src/namespaced_logging.nim +++ b/src/namespaced_logging.nim @@ -548,6 +548,9 @@ template notice*[L: Logger or Option[Logger], M](l: L, msg: M) = template warn*[L: Logger or Option[Logger], M](l: L, msg: M) = log(l, lvlWarn, msg) +template warn*[L: Logger or Option[Logger], M](l: L, err: ref Exception, msg: M) = + log(l, lvlWarn, err, msg) + template error*[L: Logger or Option[Logger], M](l: L, msg: M) = log(l, lvlError, msg)