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