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

35 lines
999 B
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: FileSink.hpp
Date: 2022-1-24
Author: Reece
***/
#pragma once
#include "../AuFormatterContainer.hpp"
namespace Aurora::Logging::Sinks
{
struct FIOSink : IFormattedSink
{
FIOSink(const AuString &path, bool bBinary);
bool Init();
void OnMessageBlocking(AuUInt8 level, const ConsoleMessage &msg) override;
bool OnMessageNonblocking(AuUInt8 level, const ConsoleMessage &msg) override;
void OnFlush() override;
private:
const AuString path_;
AuIOFS::OpenWriteUnique_t file_;
bool bBinary_;
AuByteBuffer logBuffer_;
AuThreadPrimitives::MutexUnique_t logMutex_;
ADD_FORMATTER_CONTAINER;
};
void NewFileSinkRelease(IFormattedSink *logger);
IFormattedSink *NewFileSinkNew(const AuString &str, bool bBinary);
}