AuroraRuntime/Source/Logging/Sinks/StdConsole.cpp
Reece 85a575eb95 [+] Network interfaces API
[+] Logger IFormatter API
[*] Clean up
2022-12-14 20:08:52 +00:00

56 lines
1.6 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: StdConsole.cpp
Date: 2022-2-5
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "StdConsole.hpp"
#include <Source/Console/ConsoleStd/ConsoleStd.hpp>
#include <Source/Console/ConsoleTTY/ConsoleTTY.hpp>
namespace Aurora::Logging::Sinks
{
void ConsoleStdLogger::OnMessageBlocking(AuUInt8 level, const ConsoleMessage &msg)
{
if (!gRuntimeConfig.console.asyncWrite) return;
if (Console::ConsoleTTY::gTTYConsoleEnabled)
{
Console::ConsoleTTY::WriteTTYOut(msg, this->FormatMessageHelper(level, msg, true, false, false));
}
else
{
Console::ConsoleStd::WriteStdOut(level, msg, this->FormatMessageHelper(level, msg, true, false, false));
}
}
bool ConsoleStdLogger::OnMessageNonblocking(AuUInt8 level, const ConsoleMessage &msg)
{
if (gRuntimeConfig.console.asyncWrite) return true;
if (Console::ConsoleTTY::gTTYConsoleEnabled)
{
Console::ConsoleTTY::WriteTTYOut(msg, this->FormatMessageHelper(level, msg, true, false, false));
}
else
{
Console::ConsoleStd::WriteStdOut(level, msg, this->FormatMessageHelper(level, msg, true, false, false));
}
return {};
}
// Flushing is handled by grug -> console subsystem -> console std
void ConsoleStdLogger::OnFlush()
{}
IFormattedSink *NewStdSinkNew()
{
return &gStdConsoleSink;
}
void NewStdSinkRelease(IFormattedSink *pSink)
{}
}