diff options
author | Peter Bell <peterbell10@live.co.uk> | 2020-05-15 04:35:43 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-05-16 10:39:05 +0200 |
commit | 3189a3cbee8eb9d7ded7605776a75f35e5e2f122 (patch) | |
tree | 616ed3031baa99e1f34123b645c5b3cb6ed73223 /src/LoggerSimple.h | |
parent | Enable some more clang-tidy linter checks (#4738) (diff) | |
download | cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.gz cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.bz2 cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.lz cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.xz cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.zst cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.zip |
Diffstat (limited to 'src/LoggerSimple.h')
-rw-r--r-- | src/LoggerSimple.h | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/src/LoggerSimple.h b/src/LoggerSimple.h index 83d1c4e86..f8f1ee331 100644 --- a/src/LoggerSimple.h +++ b/src/LoggerSimple.h @@ -2,64 +2,77 @@ // Logging free functions defined in Logger.cpp #pragma once +enum class eLogLevel +{ + Regular, + Info, + Warning, + Error, +}; + +namespace Logger +{ + +extern void LogFormat( + std::string_view a_Format, eLogLevel a_LogLevel, fmt::format_args a_ArgList +); +extern void LogPrintf( + std::string_view a_Format, eLogLevel a_LogLevel, fmt::printf_args a_ArgList +); +extern void LogSimple(std::string_view a_Message, eLogLevel a_LogLevel); + +} // namespace Logger + // python style format specified logging -extern void vFLOG(const char * a_Format, fmt::format_args a_ArgList); template <typename... Args> -void FLOG(const char * a_Format, const Args & ... args) +void FLOG(std::string_view a_Format, const Args & ... args) { - vFLOG(a_Format, fmt::make_format_args(args...)); + Logger::LogFormat(a_Format, eLogLevel::Regular, fmt::make_format_args(args...)); } -extern void vFLOGINFO(const char * a_Format, fmt::format_args a_ArgList); template <typename... Args> -void FLOGINFO(const char * a_Format, const Args & ... args) +void FLOGINFO(std::string_view a_Format, const Args & ... args) { - vFLOGINFO(a_Format, fmt::make_format_args(args...)); + Logger::LogFormat(a_Format, eLogLevel::Info, fmt::make_format_args(args...)); } -extern void vFLOGWARNING(const char * a_Format, fmt::format_args a_ArgList); template <typename... Args> -void FLOGWARNING(const char * a_Format, const Args & ... args) +void FLOGWARNING(std::string_view a_Format, const Args & ... args) { - vFLOGWARNING(a_Format, fmt::make_format_args(args...)); + Logger::LogFormat(a_Format, eLogLevel::Warning, fmt::make_format_args(args...)); } -extern void vFLOGERROR(const char * a_Format, fmt::format_args a_ArgList); template <typename... Args> -void FLOGERROR(const char * a_Format, const Args & ... args) +void FLOGERROR(std::string_view a_Format, const Args & ... args) { - vFLOGERROR(a_Format, fmt::make_format_args(args...)); + Logger::LogFormat(a_Format, eLogLevel::Error, fmt::make_format_args(args...)); } // printf style format specified logging (DEPRECATED) -extern void vLOG(const char * a_Format, fmt::printf_args a_ArgList); template <typename... Args> -void LOG(const char * a_Format, const Args & ... args) +void LOG(std::string_view a_Format, const Args & ... args) { - vLOG(a_Format, fmt::make_printf_args(args...)); + Logger::LogPrintf(a_Format, eLogLevel::Regular, fmt::make_printf_args(args...)); } -extern void vLOGINFO(const char * a_Format, fmt::printf_args a_ArgList); template <typename... Args> -void LOGINFO(const char * a_Format, const Args & ... args) +void LOGINFO(std::string_view a_Format, const Args & ... args) { - vLOGINFO(a_Format, fmt::make_printf_args(args...)); + Logger::LogPrintf(a_Format, eLogLevel::Info, fmt::make_printf_args(args...)); } -extern void vLOGWARNING(const char * a_Format, fmt::printf_args a_ArgList); template <typename... Args> -void LOGWARNING(const char * a_Format, const Args & ... args) +void LOGWARNING(std::string_view a_Format, const Args & ... args) { - vLOGWARNING(a_Format, fmt::make_printf_args(args...)); + Logger::LogPrintf(a_Format, eLogLevel::Warning, fmt::make_printf_args(args...)); } -extern void vLOGERROR(const char * a_Format, fmt::printf_args a_ArgList); template <typename... Args> -void LOGERROR(const char * a_Format, const Args & ... args) +void LOGERROR(std::string_view a_Format, const Args & ... args) { - vLOGERROR(a_Format, fmt::make_printf_args(args...)); + Logger::LogPrintf(a_Format, eLogLevel::Error, fmt::make_printf_args(args...)); } |