AuroraRuntime/Source/Logging/Sinks/IPCSink.hpp
Jamie Reece Wilson ca2c0462ab [*] Continue to refactor allocations of synchronization primitive away
[*] NT: Fix missing CoTaskMemFree leak on startup
[*] Fix ConsoleStd restart bug
2023-06-28 10:33:12 +01:00

33 lines
959 B
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IPCSink.hpp
Date: 2022-6-16
Author: Reece
***/
#pragma once
namespace Aurora::Logging::Sinks
{
struct IPCSink : IIPCLogger
{
IPCSink(const AuSPtr<Aurora::IO::IPC::IPCPipe> &pipe, bool lengthPrefixed);
AuSPtr<IO::IPC::IPCPipe> ToPipe() override;
bool Init();
void OnMessageBlocking(AuUInt8 level, const ConsoleMessage &msg) override;
bool OnMessageNonblocking(AuUInt8 level, const ConsoleMessage &msg) override;
void OnFlush() override;
private:
AuSPtr<Aurora::IO::IPC::IPCPipe> pipe_;
AuByteBuffer logBuffer_;
AuThreadPrimitives::Mutex logMutex_;
bool lengthPrefixed_;
};
void NewIPCSinkRelease(IIPCLogger *logger);
IIPCLogger *NewIPCSinkNew(const AuString &str, bool lengthPrefixed);
}