mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added Assert to Logger
This commit is contained in:
@@ -25,6 +25,11 @@ namespace GlitchLog
|
|||||||
|
|
||||||
public abstract void Assert(bool condition, String error = Compiler.CallerExpression[0], String filePath = Compiler.CallerFilePath, int line = Compiler.CallerLineNum);
|
public abstract void Assert(bool condition, String error = Compiler.CallerExpression[0], String filePath = Compiler.CallerFilePath, int line = Compiler.CallerLineNum);
|
||||||
|
|
||||||
|
#if !DEBUG
|
||||||
|
[SkipCall]
|
||||||
|
#endif
|
||||||
|
public abstract void AssertDebug(bool condition, String error = Compiler.CallerExpression[0], String filePath = Compiler.CallerFilePath, int line = Compiler.CallerLineNum);
|
||||||
|
|
||||||
public abstract void Log(LogLevel level, StringView format, params Object[] args);
|
public abstract void Log(LogLevel level, StringView format, params Object[] args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +117,16 @@ namespace GlitchLog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void AssertDebug(bool condition, String error = Compiler.CallerExpression[0], String filePath = Compiler.CallerFilePath, int line = Compiler.CallerLineNum)
|
||||||
|
{
|
||||||
|
if (!condition)
|
||||||
|
{
|
||||||
|
String failStr = scope .()..AppendF("Assert failed: {} at line {} in {}", error, line, filePath);
|
||||||
|
InternalLog(.Critical, failStr);
|
||||||
|
Internal.FatalError(failStr, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void InternalLog(LogLevel level, StringView format, params Object[] args)
|
private void InternalLog(LogLevel level, StringView format, params Object[] args)
|
||||||
{
|
{
|
||||||
if(_logLevel > level)
|
if(_logLevel > level)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
Runtime.Assert(s_Instance == null, "Tried to create a second application.");
|
Log.EngineLogger.Assert(s_Instance == null, "Tried to create a second application.");
|
||||||
s_Instance = this;
|
s_Instance = this;
|
||||||
|
|
||||||
_window = new Window(.Default);
|
_window = new Window(.Default);
|
||||||
|
|||||||
Reference in New Issue
Block a user