AuroraRuntime/Source/Logging/AuLogger.hpp

51 lines
1.5 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuLogger.hpp
Date: 2022-1-21
Author: Reece
***/
#pragma once
namespace Aurora::Logging
{
inline AuSPtr<ILogger> gUserLogger;
struct Logger : ILogger
{
Logger(const AuList<AuSPtr<IBasicSink>> &sinks);
~Logger();
void WriteMessage(AuUInt8 level, const ConsoleMessage &msg) override;
void PushFilter(AuUInt8 level, bool shouldFilter) override;
void PopFilter() override;
bool ExchangeMitigationState(bool bMitigationsEnabled) override;
void AddToPushQueueConst(AuUInt8 level, const ConsoleMessage &msg);
void AddToPushQueue(AuUInt8 level, ConsoleMessage &msg);
bool WriteNow(AuUInt8 level, ConsoleMessage &msg);
void WriteNowConst(AuUInt8 level, const ConsoleMessage &msg);
void WriteLater(AuUInt8 level, const ConsoleMessage &msg);
void WriteLines(AuUInt8 level, const ConsoleMessage &msg);
void Disable();
AuThreadPrimitives::SpinLock spin;
AuList<AuSPtr<IBasicSink>> sinks;
AuList<AuTuple<AuUInt8, bool>> filters; // std::vector > std::stack performance. dont ask me why or for the benchmarks, just trust me bro
AuUInt8 shouldFilter[0xFF];
bool bEnableMitigations { true };
};
AuThreadPrimitives::SpinLock &GetLock();
void ForceFlushLoggers();
void ForceFlushLoggersNoLock();
void ForceFlushFlush();
void DeinitLoggers();
void InitLoggers();
}