From b22cc2159f0ec35f394f58b8f2519161bc7d19af Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 17 Jan 2021 12:44:25 +0100 Subject: [PATCH] feat: add a fail log function --- birb/core/debug.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/birb/core/debug.lua b/birb/core/debug.lua index 9a7ae66..d23a115 100644 --- a/birb/core/debug.lua +++ b/birb/core/debug.lua @@ -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