From 0529c14367348fb1c9b0992d9cd876c6edb1ca28 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 18 Apr 2021 14:56:16 +0200 Subject: [PATCH] fix: add a one-element log system --- sonic-radiance.love/core/debug.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sonic-radiance.love/core/debug.lua b/sonic-radiance.love/core/debug.lua index 17adcb8..a1cecb7 100644 --- a/sonic-radiance.love/core/debug.lua +++ b/sonic-radiance.love/core/debug.lua @@ -45,19 +45,25 @@ end function DebugSystem:print(context, string) if (self.active) then - print("[DEBUG] ".. context .. ": " .. string) + print(self:getLogLine("DEBUG", context, string)) end end function DebugSystem:warning(context, string) if (self.active) then - print("[WARNING] " .. context .. ": " .. string) + print(self:getLogLine("WARNING", context, string)) end end function DebugSystem:error(context, string) - if (self.active) then - error("[ERROR] " .. context .. ": " .. string) + error(self:getLogLine("ERROR", context, string)) +end + +function DebugSystem:getLogLine(type, string1, string2) + if (string2 == nil) then + return "[" .. type .. "] " .. string1 + else + return "[" .. type .. "] " .. string1 .. ": " .. string2 end end