 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
11 #ifndef BITCOIN_LOGGING_H
12 #define BITCOIN_LOGGING_H
24 static const bool DEFAULT_LOGTIMEMICROS =
false;
25 static const bool DEFAULT_LOGIPS =
false;
26 static const bool DEFAULT_LOGTIMESTAMPS =
true;
147 #define LogPrintf(...) do { \
148 if(g_logger->Enabled()) { \
149 std::string _log_msg_; \
151 _log_msg_ = tfm::format(__VA_ARGS__); \
152 } catch (tinyformat::format_error &e) { \
154 _log_msg_ = "Error \"" + std::string(e.what()) + \
155 "\" while formatting log message: " + \
156 FormatStringFromLogArgs(__VA_ARGS__); \
158 g_logger->LogPrintStr(_log_msg_); \
162 #define LogPrint(category, ...) do { \
163 if (LogAcceptCategory((category))) { \
164 LogPrintf(__VA_ARGS__); \
168 #endif // BITCOIN_LOGGING_H
BCLog::Logger *const g_logger
NOTE: the logger instances is leaked on exit.
bool WillLogCategory(LogFlags category) const
std::atomic< uint32_t > m_categories
Log categories bitfield.
const char *const DEFAULT_DEBUGLOGFILE
uint32_t GetCategoryMask() const
std::vector< CLogCategoryActive > ListActiveLogCategories()
Returns a vector of the active log categories.
std::atomic_bool m_started_new_line
m_started_new_line is a state variable that will suppress printing of the timestamp when multiple cal...
std::string LogTimestampStr(const std::string &str)
std::string FormatStringFromLogArgs(const char *fmt, const Args &... args)
Get format string from VA_ARGS for error reporting.
std::list< std::string > m_msgs_before_open
void EnableCategory(LogFlags flag)
std::atomic< bool > m_reopen_file
bool Enabled() const
Returns whether logs will be written to any output.
bool DefaultShrinkDebugFile() const
bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str)
Return true if str parses as a log category and set the flag.
int LogPrintStr(const std::string &str)
Send a string to the log output.
std::string ListLogCategories()
Returns a string with the supported log categories.
void DisableCategory(LogFlags flag)