summaryrefslogtreecommitdiffstats
path: root/src/Globals.h
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-05-15 04:35:43 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-05-16 10:39:05 +0200
commit3189a3cbee8eb9d7ded7605776a75f35e5e2f122 (patch)
tree616ed3031baa99e1f34123b645c5b3cb6ed73223 /src/Globals.h
parentEnable some more clang-tidy linter checks (#4738) (diff)
downloadcuberite-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/Globals.h')
-rw-r--r--src/Globals.h43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/Globals.h b/src/Globals.h
index 121dd42d4..778bfe2b9 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -200,46 +200,43 @@ template class SizeChecker<UInt8, 1>;
// Common headers (part 1, without macros):
#include "fmt.h"
#include "StringUtils.h"
+#include "LoggerSimple.h"
#include "OSSupport/CriticalSection.h"
#include "OSSupport/Event.h"
#include "OSSupport/File.h"
#include "OSSupport/StackTrace.h"
-#ifndef TEST_GLOBALS
-
- #include "LoggerSimple.h"
+#ifdef TEST_GLOBALS
-#else
- #include "fmt/printf.h"
+ // Basic logging function implementations
+ namespace Logger
+ {
- // Logging functions
- template <typename ... Args>
- void LOG(const char * a_Format, const Args & ... a_Args)
+ inline void LogFormat(
+ std::string_view a_Format, eLogLevel, fmt::format_args a_ArgList
+ )
{
- fmt::printf(a_Format, a_Args...);
+ fmt::vprint(a_Format, a_ArgList);
putchar('\n');
fflush(stdout);
}
- #define LOGERROR LOG
- #define LOGWARNING LOG
- #define LOGD LOG
- #define LOGINFO LOG
- #define LOGWARN LOG
-
- template <typename ... Args>
- void FLOG(const char * a_Format, const Args & ... a_Args)
+ inline void LogPrintf(
+ std::string_view a_Format, eLogLevel, fmt::printf_args a_ArgList
+ )
{
- fmt::print(a_Format, a_Args...);
+ fmt::vprintf(a_Format, a_ArgList);
putchar('\n');
fflush(stdout);
}
- #define FLOGERROR FLOG
- #define FLOGWARNING FLOG
- #define FLOGD FLOG
- #define FLOGINFO FLOG
- #define FLOGWARN FLOG
+ inline void LogSimple(std::string_view a_Message, eLogLevel)
+ {
+ fmt::print("{}\n", a_Message);
+ fflush(stdout);
+ }
+
+ } // namespace Logger
#endif