AuroraRuntime/Include/Aurora/Console/Logging/Logging.hpp
Reece 99c5e1fa65 A pretty large patch not worth breaking up into separate commits
[*] Split up Aurora Async
[*] Split Async app into seperate ThreadPool concept
[*] Fix various OSThread bugs and tls transfer issues
[*] Set default affinity to 0xFFFFFFFF
[*] Update Build script
[+] Add AuTuplePopFront
[+] New Network Interface (unimplemented)
[*] Stub out the interfaces required for a better logger
[*] Fix Win32 ShellExecute bug; windows 11 struggles without explicit com init per the docs - now deferring to thread pool
[*] Update gitignore
[*] Follow XDG home standard
[*] Refactor some namespaces to use the shorthand aliases
[*] Various stability fixes
2021-11-05 17:34:23 +00:00

81 lines
2.3 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::Console::Logging
{
#if defined(_AUHAS_FMT)
template<typename ... T>
static inline void WriteLinef(const AuString &tag, const AuString &msg, T&& ... args)
{
WriteLine(ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, std::forward<T>(args)...)));
}
template<typename ... T>
static inline void WriteLinef(EAnsiColor color, const AuString &tag, const AuString &msg, T&& ... args)
{
WriteLine(ConsoleMessage(color, tag, fmt::format(msg, std::forward<T>(args)...)));
}
template<typename ... T>
static inline void LogVerbose(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
}
#if defined(STAGING) || defined(DEBUG)
template<typename ... T>
static inline void LogVerboseNoShip(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
}
#else
#define LogVerboseNoShip(...) DoNothing()
#endif
static inline void DoNothing()
{
}
template<typename ... T>
static inline void LogInfo(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eGreen, "Info", line, std::forward<T>(args)...);
}
template<typename ... T>
static inline void LogDbg(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eYellow, "Debug", line, std::forward<T>(args)...);
}
template<typename ... T>
static inline void LogWarn(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eRed, "Warn", line, std::forward<T>(args)...);
}
template<typename ... T>
static inline void LogError(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eBoldRed, "Error", line, std::forward<T>(args)...);
}
template<typename ... T>
static inline void LogGame(const AuString &line, T&& ... args)
{
WriteLinef(EAnsiColor::eBlue, "Game", line, std::forward<T>(args)...);
}
#endif
}