12 #ifndef PIVX_LOGGING_H
13 #define PIVX_LOGGING_H
25 static const bool DEFAULT_LOGTIMEMICROS =
false;
26 static const bool DEFAULT_LOGIPS =
false;
27 static const bool DEFAULT_LOGTIMESTAMPS =
true;
146 template <
typename... Args>
147 static inline void LogPrintf(
const char* fmt,
const Args&... args)
155 log_msg =
"Error \"" + std::string(fmterr.what()) +
"\" while formatting log message: " + fmt;
163 #define LogPrint(category, ...) do { \
164 if (LogAcceptCategory((category))) { \
165 LogPrintf(__VA_ARGS__); \
183 template<
typename... Args>
184 void Batch(
const std::string& fmt,
const Args&... args)
bool WillLogCategory(LogFlags category) const
bool Enabled() const
Returns whether logs will be written to any output.
std::string LogTimestampStr(const std::string &str)
std::list< std::string > m_msgs_before_open
std::atomic< uint32_t > m_categories
Log categories bitfield.
bool DefaultShrinkDebugFile() const
void LogPrintStr(const std::string &str)
Send a string to the log output.
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...
void EnableCategory(LogFlags flag)
std::atomic< bool > m_reopen_file
uint32_t GetCategoryMask() const
void DisableCategory(LogFlags flag)
virtual ~CBatchedLogger()
void Batch(const std::string &fmt, const Args &... args)
CBatchedLogger(BCLog::Logger *_logger, BCLog::LogFlags _category, const std::string &_header)
PIVX.
std::vector< CLogCategoryActive > ListActiveLogCategories()
Returns a vector of the active log categories.
BCLog::Logger *const g_logger
NOTE: the logger instances is leaked on exit.
bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str)
Return true if str parses as a log category and set the flag.
const char *const DEFAULT_DEBUGLOGFILE
std::string ListLogCategories()
Returns a string with the supported log categories.