Changeset View
Changeset View
Standalone View
Standalone View
src/logging.h
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** Returns a string with the supported log categories */ | /** Returns a string with the supported log categories */ | ||||
std::string ListLogCategories(); | std::string ListLogCategories(); | ||||
/** Return true if str parses as a log category and set the flag */ | /** Return true if str parses as a log category and set the flag */ | ||||
bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str); | bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str); | ||||
// Be conservative when using LogPrintf/error or other things which | |||||
// unconditionally log to debug.log! It should not be the case that an inbound | |||||
// peer can fill up a users disk with debug.log entries. | |||||
#define LogPrint(category, ...) \ | #define LogPrint(category, ...) \ | ||||
do { \ | do { \ | ||||
if (LogAcceptCategory((category))) { \ | if (LogAcceptCategory((category))) { \ | ||||
GetLogger().LogPrintStr(tfm::format(__VA_ARGS__)); \ | GetLogger().LogPrintStr(tfm::format(__VA_ARGS__)); \ | ||||
} \ | } \ | ||||
} while (0) | } while (0) | ||||
#define LogPrintf(...) \ | #define LogPrintf(...) \ | ||||
do { \ | do { \ | ||||
GetLogger().LogPrintStr(tfm::format(__VA_ARGS__)); \ | GetLogger().LogPrintStr(tfm::format(__VA_ARGS__)); \ | ||||
} while (0) | } while (0) | ||||
#endif // BITCOIN_LOGGING_H | #endif // BITCOIN_LOGGING_H |