fix: add a one-element log system
This commit is contained in:
parent
32c72c18e9
commit
0529c14367
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue