fix: add a one-element log system

This commit is contained in:
Kazhnuz 2021-04-18 14:56:16 +02:00
parent 32c72c18e9
commit 0529c14367

View file

@ -45,19 +45,25 @@ end
function DebugSystem:print(context, string) function DebugSystem:print(context, string)
if (self.active) then if (self.active) then
print("[DEBUG] ".. context .. ": " .. string) print(self:getLogLine("DEBUG", context, string))
end end
end end
function DebugSystem:warning(context, string) function DebugSystem:warning(context, string)
if (self.active) then if (self.active) then
print("[WARNING] " .. context .. ": " .. string) print(self:getLogLine("WARNING", context, string))
end end
end end
function DebugSystem:error(context, string) function DebugSystem:error(context, string)
if (self.active) then error(self:getLogLine("ERROR", context, string))
error("[ERROR] " .. context .. ": " .. string) end
function DebugSystem:getLogLine(type, string1, string2)
if (string2 == nil) then
return "[" .. type .. "] " .. string1
else
return "[" .. type .. "] " .. string1 .. ": " .. string2
end end
end end