logging: bypass timestamp formatting when not logging

This leads to massive speedups under Wine.
This commit is contained in:
Cory Fields 2018-04-12 17:22:49 -04:00
parent 39439e5ab4
commit 339730a6d8

View file

@ -145,6 +145,7 @@ template<typename T, typename... Args> static inline void MarkUsed(const T& t, c
#define LogPrint(category, ...) do { MarkUsed(__VA_ARGS__); } while(0) #define LogPrint(category, ...) do { MarkUsed(__VA_ARGS__); } while(0)
#else #else
#define LogPrintf(...) do { \ #define LogPrintf(...) do { \
if (fPrintToConsole || fPrintToDebugLog) { \
std::string _log_msg_; /* Unlikely name to avoid shadowing variables */ \ std::string _log_msg_; /* Unlikely name to avoid shadowing variables */ \
try { \ try { \
_log_msg_ = tfm::format(__VA_ARGS__); \ _log_msg_ = tfm::format(__VA_ARGS__); \
@ -153,6 +154,7 @@ template<typename T, typename... Args> static inline void MarkUsed(const T& t, c
_log_msg_ = "Error \"" + std::string(fmterr.what()) + "\" while formatting log message: " + FormatStringFromLogArgs(__VA_ARGS__); \ _log_msg_ = "Error \"" + std::string(fmterr.what()) + "\" while formatting log message: " + FormatStringFromLogArgs(__VA_ARGS__); \
} \ } \
LogPrintStr(_log_msg_); \ LogPrintStr(_log_msg_); \
} \
} while(0) } while(0)
#define LogPrint(category, ...) do { \ #define LogPrint(category, ...) do { \