From 8a4e3743e7c3629be11b85edcbb60fc0d402aa75 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sat, 13 Apr 2024 23:20:32 +0200 Subject: [PATCH] Logging - Using the build variable `DBG_DEBUG_LOGGING` will now allow you to enable debug logging Dub - Enable debug logging by default --- dub.json | 3 ++- source/tlang/misc/logging.d | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dub.json b/dub.json index 47fd281..18c836f 100644 --- a/dub.json +++ b/dub.json @@ -13,6 +13,7 @@ "license": "GPLv3", "name": "tlang", "versions": [ - "DBG_MODMAN" + "DBG_MODMAN", + "DBG_DEBUG_LOGGING" ] } diff --git a/source/tlang/misc/logging.d b/source/tlang/misc/logging.d index 4fd15fd..117298c 100644 --- a/source/tlang/misc/logging.d +++ b/source/tlang/misc/logging.d @@ -38,8 +38,18 @@ static this() logger.mode(mode); - // TODO: In future make this configurable - logger.setLevel(Level.DEBUG); + Level level; + + version(DBG_DEBUG_LOGGING) + { + level = Level.DEBUG; + } + else + { + level = Level.INFO; + } + + logger.setLevel(level); logger.addHandler(new FileHandler(stdout)); }