From de480a89348818085aecd1fb8933ebf034ff271c Mon Sep 17 00:00:00 2001 From: Linventif Date: Tue, 27 May 2025 19:15:27 +0000 Subject: [PATCH] feat: only log timestamp on debug --- lua/gmod_integration/core/utils/sh_utils.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lua/gmod_integration/core/utils/sh_utils.lua b/lua/gmod_integration/core/utils/sh_utils.lua index 22b152d..4b735d4 100644 --- a/lua/gmod_integration/core/utils/sh_utils.lua +++ b/lua/gmod_integration/core/utils/sh_utils.lua @@ -1,24 +1,29 @@ +local function getTimeStamp() + if !gmInte.config.debug then return "" end + return os.date("[%Y-%m-%d %H:%M:%S]") +end + function gmInte.log(msg, debug) if debug && !gmInte.config.debug then return end - print("[" .. os.date("%Y-%m-%d %H:%M:%S") .. "] [Gmod Integration] " .. msg) + print(getTimeStamp() .. " [Gmod Integration] " .. msg) end // Log Error function gmInte.logError(msg, debug) if debug && !gmInte.config.debug then return end - print("[" .. os.date("%Y-%m-%d %H:%M:%S") .. "] [Gmod Integration] [ERROR] " .. msg) + print(getTimeStamp() .. " [Gmod Integration] [ERROR] " .. msg) end // Log Warning function gmInte.logWarning(msg, debug) if debug && !gmInte.config.debug then return end - print("[" .. os.date("%Y-%m-%d %H:%M:%S") .. "] [Gmod Integration] [WARNING] " .. msg) + print(getTimeStamp() .. " [Gmod Integration] [WARNING] " .. msg) end // Log Hint function gmInte.logHint(msg, debug) if debug && !gmInte.config.debug then return end - print("[" .. os.date("%Y-%m-%d %H:%M:%S") .. "] [Gmod Integration] [HINT] " .. msg) + print(getTimeStamp() .. " [Gmod Integration] [HINT] " .. msg) end // Is Private IP