Browse Source

Do not evaluate hidden LogPrint arguments

0.14
Pieter Wuille 8 years ago
parent
commit
407cdd6cb8
  1. 17
      src/util.h

17
src/util.h

@ -74,14 +74,15 @@ bool LogAcceptCategory(const char* category);
/** Send a string to the log output */ /** Send a string to the log output */
int LogPrintStr(const std::string &str); int LogPrintStr(const std::string &str);
#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__) #define LogPrint(category, ...) do { \
if (LogAcceptCategory((category))) { \
template<typename... Args> LogPrintStr(tfm::format(__VA_ARGS__)); \
static inline int LogPrint(const char* category, const char* fmt, const Args&... args) } \
{ } while(0)
if(!LogAcceptCategory(category)) return 0; \
return LogPrintStr(tfm::format(fmt, args...)); #define LogPrintf(...) do { \
} LogPrintStr(tfm::format(__VA_ARGS__)); \
} while(0)
template<typename... Args> template<typename... Args>
bool error(const char* fmt, const Args&... args) bool error(const char* fmt, const Args&... args)

Loading…
Cancel
Save