AuroraRuntime/Source/Logging/Sinks/DebugLogger.NT.cpp
Reece f717511a10 [+] NT OutputDebugStringW logger sink
[*] Split objects
[*] Consider making ABI object api boilerplate
[*] Refactor STLShims (roxtl)
2022-03-31 01:31:40 +01:00

46 lines
1.1 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: DeebugLogger.NT.cpp
Date: 2022-3-31
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "DebugLogger.NT.hpp"
namespace Aurora::Logging::Sinks
{
void ConsoleDebugLogger::OnMessageBlocking(AuUInt8 level, const ConsoleMessage &msg)
{
if (!gRuntimeConfig.console.asyncVSLog) return;
Write(msg);
}
bool ConsoleDebugLogger::OnMessageNonblocking(AuUInt8 level, const ConsoleMessage &msg)
{
if (gRuntimeConfig.console.asyncVSLog) return true;
Write(msg);
return {};
}
void ConsoleDebugLogger::OnFlush()
{}
void ConsoleDebugLogger::Write(const ConsoleMessage &msg)
{
#if (defined(DEBUG) || defined(STAGING)) && defined(AURORA_IS_MODERNNT_DERIVED)
auto debugLine = msg.ToSimplified() + "\r\n";
OutputDebugStringW(Locale::ConvertFromUTF8(debugLine).c_str());
#endif
}
void NewDebugLoggerRelease(IBasicSink *logger)
{
}
IBasicSink *NewDebugLoggerNew()
{
return &gDebugLoggerNt;
}
}