AuroraRuntime/Source/Logging/AuLogSinks.cpp

134 lines
3.4 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuLogSinks.cpp
Date: 2022-1-21
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuLogSinks.hpp"
#include "Sinks/FileSink.hpp"
#include "Sinks/StdConsole.hpp"
#include "Sinks/RingBuffer.hpp"
#include "Sinks/DirLogArchive.hpp"
#include "Sinks/IPCSink.hpp"
#include "Sinks/StreamSink.hpp"
#if defined(AURORA_PLATFORM_WIN32)
#include "Sinks/EventLog.Win32.hpp"
#endif
#if defined(AURORA_IS_MODERNNT_DERIVED)
#include "Sinks/DebugLogger.NT.hpp"
#endif
#if defined(AURORA_IS_POSIX_DERIVED)
#include "Sinks/SysLog.Unix.hpp"
#endif
namespace Aurora::Logging
{
AUKN_SYM IFormattedSink *NewStdSinkNew()
{
return Sinks::NewStdSinkNew();
}
AUKN_SYM void NewStdSinkRelease(IFormattedSink *pSink)
{
Sinks::NewStdSinkRelease(pSink);
}
AUKN_SYM IBasicSink *NewOSEventDirectorySinkNew()
{
return {};
}
AUKN_SYM void NewOSEventDirectorySinkRelease(IBasicSink *pSink)
{}
AUKN_SYM IBasicSink *NewDebugLoggerNew()
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
return Sinks::NewDebugLoggerNew();
#endif
return {};
}
AUKN_SYM void NewDebugLoggerRelease(IBasicSink *pSink)
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
return Sinks::NewDebugLoggerRelease(pSink);
#endif
}
AUKN_SYM IBasicSink *NewOSNamedEventDirectorySinkNew(const AuString &name)
{
#if defined(AURORA_PLATFORM_WIN32) || defined(AURORA_IS_POSIX_DERIVED)
return Sinks::NewOSNamedEventDirectorySinkNew(name);
#endif
return {};
}
AUKN_SYM void NewOSNamedEventDirectorySinkRelease(IBasicSink *pSink)
{
#if defined(AURORA_PLATFORM_WIN32) || defined(AURORA_IS_POSIX_DERIVED)
Sinks::NewOSNamedEventDirectorySinkRelease(pSink);
#endif
}
AUKN_SYM IBasicSink *NewDirectorySinkNew(const AuString &path, DirectoryLogger dirInfo, ELogMode eMode)
{
return Sinks::NewDirectoryLoggerNew(path, dirInfo, eMode == ELogMode::eBinary);
}
AUKN_SYM void NewDirectorySinkRelease(IBasicSink *pSink)
{
Sinks::NewDirectoryLoggerRelease(pSink);
}
AUKN_SYM IFormattedSink *NewFileSinkNew(const AuString &path, ELogMode eMode)
{
return Sinks::NewFileSinkNew(path, eMode == ELogMode::eBinary);
}
AUKN_SYM void NewFileSinkRelease(IFormattedSink *pSink)
{
Sinks::NewFileSinkRelease(pSink);
}
AUKN_SYM IIPCLogger *NewIPCSinkNew(const AuString &path, EPrefixMode ePrefixMode)
{
return Sinks::NewIPCSinkNew(path, ePrefixMode == EPrefixMode::eIncludeU32BlockLength);
}
AUKN_SYM void NewIPCSinkRelease(IIPCLogger *pSink)
{
Sinks::NewIPCSinkRelease(pSink);
}
AUKN_SYM IBasicSinkRB *NewRingLoggerNew(AuUInt32 maxLogEntries)
{
return Sinks::NewRingBufferNew(maxLogEntries);
}
AUKN_SYM void NewStreamSinkRelease(IFormattedSink *pSink)
{
Sinks::NewStreamSinkRelease(pSink);
}
AUKN_SYM IFormattedSink *NewStreamSinkNew(const StreamLogger &streamLogger)
{
return Sinks::NewStreamSinkNew(streamLogger.pOutputStream,
streamLogger.eLogMode == ELogMode::eText,
streamLogger.ePrefixMode == EPrefixMode::eIncludeU32BlockLength);
}
AUKN_SYM void NewRingLoggerRelease(IBasicSinkRB *pSink)
{
Sinks::NewRingBufferRelease(pSink);
}
}