Reece
cf70f0d45c
The intention is to quickly improve and add util apis, enhance functionality given current demands, go back to the build pipeline, finish that, publish runtime tests, and then use what we have to go back to to linux support with a more stable api. [+] AuMakeSharedArray [+] Technet ArgvQuote [+] Grug subsystem (UNIX signal thread async safe ipc + telemetry flusher + log flusher.) [+] auEndianness -> Endian swap utils [+] AuGet<N>(...) [*] AUE_DEFINE conversion for ECompresionType, EAnsiColor, EHashType, EStreamError, EHexDump [+] ConsoleMessage ByteBuffer serialization [+] CmdLine subsystem for parsing command line arguments and simple switch/flag checks [*] Split logger from console subsystem [+] StartupParameters -> A part of a clean up effort under Process [*] Refactor SysErrors header + get caller hack [+] Atomic APIs [+] popcnt [+] Ring Buffer sink [+] Added more standard errors Catch, Submission, LockError, NoAccess, ResourceMissing, ResourceLocked, MalformedData, InSandboxContext, ParseError [+] Added ErrorCategorySet, ErrorCategoryClear, GetStackTrace [+] IExitSubscriber, ETriggerLevel [*] Write bias the high performance RWLockImpl read-lock operation operation [+] ExitHandlerAdd/ExitHandlerRemove (exit subsystem) [*] Updated API style Digests [+] CpuId::CpuBitCount [+] GetUserProgramsFolder [+] GetPackagePath [*] Split IStreamReader with an inl file [*] BlobWriter/BlobReader/BlobArbitraryReader can now take shared pointers to bytebuffers. default constructor allocates a new scalable bytebuffer [+] ICharacterProvider [+] ICharacterProviderEx [+] IBufferedCharacterConsumer [+] ProviderFromSharedString [+] ProviderFromString [+] BufferConsumerFromProvider [*] Parse Subsystem uses character io bufferer [*] Rewritten NT's high perf semaphore to use userland SRW/ConVars [like mutex, based on generic semaphore] [+] ByteBuffer::ResetReadPointer [*] Bug fix bytebuffer base not reset on free and some scaling issues [+] ProcessMap -> Added kSectionNameStack, kSectionNameFile, kSectionNameHeap for Section [*] ProcessMap -> Refactor Segment to Section. I was stupid for keeping a type conflict hack API facing [+] Added 64 *byte* fast RNG seeds [+] File Advisorys/File Lock Awareness [+] Added extended IAuroraThread from OS identifier caches for debug purposes [*] Tweaked how memory is reported on Windows. Better consistency of what values mean across functions. [*] Broke AuroraUtils/Typedefs out into a separate library [*] Update build script [+] Put some more effort into adding detail to the readme before rewriting it, plus, added some media [*] Improved public API documentation [*] Bug fix `SetConsoleCtrlHandler` [+] Locale TimeDateToFileNameISO8601 [+] Console config stdOutShortTime [*] Begin using internal UTF8/16 decoders when platform support isnt available (instead of stl) [*] Bug fixes in decoders [*] Major bug fix, AuMax [+] RateLimiter [+] Binary file sink [+] Log directory sink [*] Data header usability (more operators) [+] AuRemoveRange [+] AuRemove [+] AuTryRemove [+] AuTryRemoveRange [+] auCastUtils [+] Finish NewLSWin32Source [+] AuTryFindByTupleN, AuTryRemoveByTupleN [+] Separated AuRead/Write types, now in auTypeUtils [+] Added GetPosition/SetPosition to FileWriter [*] Fix stupid AuMin in place of AuMax in SpawnThread.Unix.Cpp [*] Refactored Arbitrary readers to SeekingReaders (as in, they could be atomic and/or parallelized, and accept an arbitrary position as a work parameter -> not Seekable, as in, you can simply set the position) [*] Hack back in the sched deinit [+] File AIO loop source interop [+] Begin to prototype a LoopQueue object I had in mind for NT, untested btw [+] Stub code for networking [+] Compression BaseStream/IngestableStreamBase [*] Major: read/write locks now support write-entrant read routines. [*] Compression subsystem now uses the MemoryView concept [*] Rewrite the base stream compressions, made them less broken [*] Update hashing api [*] WriterTryGoForward and ReaderTryGoForward now revert to the previous relative index instead of panicing [+] Added new AuByteBuffer apis Trim, Pad, WriteFrom, WriteString, [TODO: ReadString] [+] Added ByteBufferPushReadState [+] Added ByteBufferPushWriteState [*] Move from USC-16 to full UTF-16. Win32 can handle full UTF-16. [*] ELogLevel is now an Aurora enum [+] Raised arbitrary limit in header to 255, the max filter buffer [+] Explicit GZip support [+] Explicit Zip support [+] Added [some] compressors et al
164 lines
4.7 KiB
C++
164 lines
4.7 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Logging.hpp
|
|
Date: 2021-9-21
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "ILogger.hpp"
|
|
#include "IBasicSink.hpp"
|
|
#include "IBasicSinkRB.hpp"
|
|
#include "Sinks.hpp"
|
|
|
|
namespace Aurora::Logging
|
|
{
|
|
/// Writes a log message to the console subscribers and telemetry sinks
|
|
AUKN_SYM void WriteLine(AuUInt8 level, const Console::ConsoleMessage &msg);
|
|
|
|
/**
|
|
* @brief Overloads the ILogger backend of the AuLogXX functions
|
|
* @param defaultGlobalLogger
|
|
* @return
|
|
*/
|
|
AUKN_SYM void SetGlobalLogger(const AuSPtr<Logging::ILogger> &defaultGlobalLogger);
|
|
|
|
|
|
#if defined(_AUHAS_FMT)
|
|
|
|
template<typename ... T>
|
|
inline void WriteLinef(AuUInt8 level, const AuString &tag, const AuString &msg, T&& ... args)
|
|
{
|
|
WriteLine(level, ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, AuForward<T>(args)...)));
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void WriteLinef(AuUInt8 level, EAnsiColor color, const AuString &tag, const AuString &msg, T&& ... args)
|
|
{
|
|
WriteLine(level, ConsoleMessage(color, tag, fmt::format(msg, AuForward<T>(args)...)));
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogVerbose(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
#if defined(STAGING) || defined(DEBUG)
|
|
template<typename ... T>
|
|
inline auline void LogVerboseNoShip(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eYellow, "Verbose", line, AuForward<T>(args)...);
|
|
}
|
|
#else
|
|
template<typename ... T>
|
|
inline auline void LogVerboseNoShip(const AuString &line, T&& ... args)
|
|
{}
|
|
#endif
|
|
|
|
inline void DoNothing()
|
|
{
|
|
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogInfo(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eInfo), EAnsiColor::eGreen, "Info", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogDbg(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eDebug), EAnsiColor::eYellow, "Debug", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogWarn(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eWarn), EAnsiColor::eRed, "Warn", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogError(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eError), EAnsiColor::eBoldRed, "Error", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
template<typename ... T>
|
|
inline void LogGame(const AuString &line, T&& ... args)
|
|
{
|
|
WriteLinef(static_cast<AuUInt8>(ELogLevel::eVerbose), EAnsiColor::eBlue, "Game", line, AuForward<T>(args)...);
|
|
}
|
|
|
|
#else
|
|
|
|
static void LogVerbose(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eVerbose), ConsoleMessage(EAnsiColor::eYellow, "Verbose", line));
|
|
}
|
|
|
|
#if defined(STAGING) || defined(DEBUG)
|
|
static void LogVerboseNoShip(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eVerbose), ConsoleMessage(EAnsiColor::eYellow, "Verbose", line));
|
|
}
|
|
#else
|
|
#define LogVerboseNoShip(...) DoNothing()
|
|
#endif
|
|
|
|
static void DoNothing()
|
|
{
|
|
|
|
}
|
|
|
|
static void LogInfo(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eInfo), ConsoleMessage(EAnsiColor::eGreen, "Info", line));
|
|
}
|
|
|
|
static void LogDbg(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eDebug), ConsoleMessage(EAnsiColor::eYellow, "Debug", line));
|
|
}
|
|
|
|
static void LogWarn(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eWarn), ConsoleMessage(EAnsiColor::eRed, "Warn", line));
|
|
}
|
|
|
|
static void LogError(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eError), ConsoleMessage(EAnsiColor::eBoldRed, "Error", line));
|
|
}
|
|
|
|
static void LogGame(const AuString &line)
|
|
{
|
|
WriteLine(static_cast<AuUInt8>(ELogLevel::eGame), ConsoleMessage(EAnsiColor::eBlue, "Game", line));
|
|
}
|
|
|
|
#endif
|
|
}
|
|
|
|
#define ADD_AU_GLOBAL_ALIAS(level)\
|
|
template<typename ... T> \
|
|
static void AuLog ## level(T&& ... args) \
|
|
{ \
|
|
Aurora::Logging::Log ## level(AuForward<T>(args)...); \
|
|
}
|
|
|
|
ADD_AU_GLOBAL_ALIAS(Info)
|
|
ADD_AU_GLOBAL_ALIAS(Dbg)
|
|
ADD_AU_GLOBAL_ALIAS(Warn)
|
|
ADD_AU_GLOBAL_ALIAS(Error)
|
|
ADD_AU_GLOBAL_ALIAS(Game)
|
|
ADD_AU_GLOBAL_ALIAS(Verbose)
|
|
|
|
#if defined(STAGING) || defined(DEBUG)
|
|
ADD_AU_GLOBAL_ALIAS(VerboseNoShip)
|
|
#else
|
|
#define AuLogVerboseNoShip(...)
|
|
#endif
|
|
|
|
#undef ADD_AU_GLOBAL_ALIAS |