2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: Logging.hpp
|
2021-11-05 17:34:23 +00:00
|
|
|
Date: 2021-9-21
|
2021-06-27 21:25:29 +00:00
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
2021-11-05 17:34:23 +00:00
|
|
|
#include "ILogger.hpp"
|
|
|
|
#include "IBasicSink.hpp"
|
|
|
|
#include "IBasicSinkRB.hpp"
|
|
|
|
#include "Sinks.hpp"
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
namespace Aurora::Console::Logging
|
|
|
|
{
|
2021-09-06 10:58:08 +00:00
|
|
|
#if defined(_AUHAS_FMT)
|
2021-06-27 21:25:29 +00:00
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void WriteLinef(const AuString &tag, const AuString &msg, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLine(ConsoleMessage(EAnsiColor::eReset, tag, fmt::format(msg, std::forward<T>(args)...)));
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void WriteLinef(EAnsiColor color, const AuString &tag, const AuString &msg, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLine(ConsoleMessage(color, tag, fmt::format(msg, std::forward<T>(args)...)));
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
2021-10-21 15:01:48 +00:00
|
|
|
|
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogVerbose(const AuString &line, T&& ... args)
|
2021-10-21 15:01:48 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
|
2021-10-21 15:01:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(STAGING) || defined(DEBUG)
|
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogVerboseNoShip(const AuString &line, T&& ... args)
|
2021-10-21 15:01:48 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eYellow, "Verbose", line, std::forward<T>(args)...);
|
2021-10-21 15:01:48 +00:00
|
|
|
}
|
|
|
|
#else
|
2021-11-05 17:34:23 +00:00
|
|
|
#define LogVerboseNoShip(...) DoNothing()
|
2021-10-21 15:01:48 +00:00
|
|
|
#endif
|
2021-06-27 21:25:29 +00:00
|
|
|
|
2021-11-05 17:34:23 +00:00
|
|
|
static inline void DoNothing()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogInfo(const AuString &line, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eGreen, "Info", line, std::forward<T>(args)...);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogDbg(const AuString &line, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eYellow, "Debug", line, std::forward<T>(args)...);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogWarn(const AuString &line, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eRed, "Warn", line, std::forward<T>(args)...);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
|
2021-10-21 15:01:48 +00:00
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogError(const AuString &line, T&& ... args)
|
2021-10-21 15:01:48 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eBoldRed, "Error", line, std::forward<T>(args)...);
|
2021-10-21 15:01:48 +00:00
|
|
|
}
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
template<typename ... T>
|
2021-10-23 19:21:16 +00:00
|
|
|
static inline void LogGame(const AuString &line, T&& ... args)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-23 19:21:16 +00:00
|
|
|
WriteLinef(EAnsiColor::eBlue, "Game", line, std::forward<T>(args)...);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
2021-09-06 10:58:08 +00:00
|
|
|
#endif
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|