40 lines
1001 B
C++
40 lines
1001 B
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: Logging.cpp
|
||
|
Date: 2022-1-21
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#include <Source/RuntimeInternal.hpp>
|
||
|
#include "Logger.hpp"
|
||
|
#include <Source/Console/Hooks/Hooks.hpp>
|
||
|
#include <Source/Console/Console.hpp>
|
||
|
|
||
|
namespace Aurora::Logging
|
||
|
{
|
||
|
AUKN_SYM void WriteLine(AuUInt8 level, const Console::ConsoleMessage &msg)
|
||
|
{
|
||
|
Console::Hooks::WriteLine(msg);
|
||
|
if (gUserLogger)
|
||
|
{
|
||
|
gUserLogger->WriteMessage(level, msg);
|
||
|
}
|
||
|
else if (!Console::gDefaultLogger)
|
||
|
{
|
||
|
auto tmp = Console::CreateDefaultLogger();
|
||
|
if (tmp)
|
||
|
{
|
||
|
tmp->WriteMessage(level, msg);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Console::gDefaultLogger->WriteMessage(level, msg);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
AUKN_SYM void SetGlobalLogger(const AuSPtr<Logging::ILogger> &defaultGlobalLogger)
|
||
|
{
|
||
|
gUserLogger = defaultGlobalLogger;
|
||
|
}
|
||
|
}
|