diff options
author | Daniel Lim Wee Soong <weesoong.lim@gmail.com> | 2018-03-22 11:21:29 +0100 |
---|---|---|
committer | Daniel Lim Wee Soong <weesoong.lim@gmail.com> | 2018-03-22 11:21:29 +0100 |
commit | 3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e (patch) | |
tree | c6e2a53e92f1ef289edf26212a0f82fb0c97e718 /src/common/logging/log.h | |
parent | Merge pull request #215 from N00byKing/umapsharedmmry (diff) | |
download | yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.gz yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.bz2 yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.lz yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.xz yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.tar.zst yuzu-3b558eebee54fa4bc9d1a7bb428d4bd33e1b817e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/logging/log.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 3cf13fcb0..31fa932fb 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -4,6 +4,8 @@ #pragma once +#include <chrono> +#include <fmt/format.h> #include "common/common_types.h" namespace Log { @@ -87,7 +89,7 @@ enum class Class : ClassType { }; /// Logs a message to the global logger. -void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_nr, +void LogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, #ifdef _MSC_VER _Printf_format_string_ @@ -99,6 +101,10 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned #endif ; +void FmtLogMessage(Class log_class, Level log_level, const char* filename, unsigned int line_num, + const char* function, const char* format, const fmt::ArgList& args); +FMT_VARIADIC(void, FmtLogMessage, Class, Level, const char*, unsigned int, const char*, const char*) + } // namespace Log #define LOG_GENERIC(log_class, log_level, ...) \ @@ -121,3 +127,28 @@ void LogMessage(Class log_class, Level log_level, const char* filename, unsigned LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Error, __VA_ARGS__) #define LOG_CRITICAL(log_class, ...) \ LOG_GENERIC(::Log::Class::log_class, ::Log::Level::Critical, __VA_ARGS__) + +// Define the fmt lib macros +#ifdef _DEBUG +#define NGLOG_TRACE(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Trace, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) +#else +#define NGLOG_TRACE(log_class, fmt, ...) (void(0)) +#endif + +#define NGLOG_DEBUG(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Debug, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) +#define NGLOG_INFO(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Info, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) +#define NGLOG_WARNING(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Warning, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) +#define NGLOG_ERROR(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Error, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) +#define NGLOG_CRITICAL(log_class, ...) \ + ::Log::FmtLogMessage(::Log::Class::log_class, ::Log::Level::Critical, __FILE__, __LINE__, \ + __func__, __VA_ARGS__) |