Jamie Reece Wilson
ca2c0462ab
[*] NT: Fix missing CoTaskMemFree leak on startup [*] Fix ConsoleStd restart bug
35 lines
999 B
C++
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::Mutex logMutex_;
|
|
ADD_FORMATTER_CONTAINER;
|
|
};
|
|
|
|
void NewFileSinkRelease(IFormattedSink *logger);
|
|
IFormattedSink *NewFileSinkNew(const AuString &str, bool bBinary);
|
|
} |