56 lines
1.6 KiB
C++
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)
|
|
{}
|
|
} |