Add support for building engine without logging
This commit is contained in:
@@ -52,13 +52,16 @@ DEFINE_INTERNAL_CALL(int32) PlatformInternal_MemoryCompare(const void* buf1, con
|
||||
|
||||
DEFINE_INTERNAL_CALL(void) DebugLogHandlerInternal_LogWrite(LogType level, MString* msgObj)
|
||||
{
|
||||
#if LOG_ENABLE
|
||||
StringView msg;
|
||||
MUtils::ToString(msgObj, msg);
|
||||
Log::Logger::Write(level, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(void) DebugLogHandlerInternal_Log(LogType level, MString* msgObj, ScriptingObject* obj, MString* stackTrace)
|
||||
{
|
||||
#if LOG_ENABLE
|
||||
if (msgObj == nullptr)
|
||||
return;
|
||||
|
||||
@@ -71,6 +74,7 @@ DEFINE_INTERNAL_CALL(void) DebugLogHandlerInternal_Log(LogType level, MString* m
|
||||
// TODO: maybe option for build to threat warnings and errors as fatal errors?
|
||||
//const String logMessage = String::Format(TEXT("Debug:{1} {2}"), objName, *msg);
|
||||
Log::Logger::Write(level, msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(void) DebugLogHandlerInternal_LogException(MObject* exception, ScriptingObject* obj)
|
||||
|
||||
@@ -246,6 +246,7 @@ MType* MEvent::GetType() const
|
||||
|
||||
void MException::Log(const LogType type, const Char* target)
|
||||
{
|
||||
#if LOG_ENABLE
|
||||
// Log inner exceptions chain
|
||||
MException* inner = InnerException;
|
||||
while (inner)
|
||||
@@ -260,6 +261,7 @@ void MException::Log(const LogType type, const Char* target)
|
||||
const String info = target && *target ? String::Format(TEXT("Exception has been thrown during {0}."), target) : TEXT("Exception has been thrown.");
|
||||
Log::Logger::Write(LogType::Warning, String::Format(TEXT("{0} {1}\nStack strace:\n{2}"), info, Message, stackTrace));
|
||||
Log::Logger::Write(type, String::Format(TEXT("{0}\n{1}"), info, Message));
|
||||
#endif
|
||||
}
|
||||
|
||||
MType* MProperty::GetType() const
|
||||
|
||||
Reference in New Issue
Block a user