feat: add a fail log function

This commit is contained in:
Kazhnuz Klappsthul 2021-01-17 12:44:25 +01:00
parent 0f4b6daf73
commit b22cc2159f
1 changed files with 11 additions and 0 deletions

View File

@ -125,6 +125,17 @@ function DebugSystem:logError(context, string)
end
end
--- Log an error and fail
--
-- @param context the context of the log
-- @param string the logged string
function DebugSystem:fail(context, string)
if (self:isError()) then
print(self:createLogLine("ERROR", context, string))
error(string)
end
end
--- Create a formatted debug line
--
-- @param level the level of the log