AuroraRuntime/Source/Logging/Sinks/DebugLogger.NT.cpp

46 lines
1.1 KiB
C++
Raw Normal View History

/***
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;
}
}