7 #ifndef BITCOIN_LOGGING_H 8 #define BITCOIN_LOGGING_H 69 std::list<std::string> m_msgs_before_open
GUARDED_BY(m_cs);
77 std::atomic_bool m_started_new_line{
true};
82 std::atomic<uint32_t> m_categories{0};
84 std::string LogTimestampStr(
const std::string &str);
87 std::list<std::function<void(const std::string &)>>
91 bool m_print_to_console =
false;
92 bool m_print_to_file =
false;
99 std::atomic<bool> m_reopen_file{
false};
104 void LogPrintStr(
const std::string &str);
109 return m_buffering || m_print_to_console || m_print_to_file ||
110 !m_print_callbacks.empty();
114 std::list<std::function<void(const std::string &)>>::iterator
117 m_print_callbacks.push_back(std::move(fun));
118 return --m_print_callbacks.end();
123 std::list<std::function<
void(
const std::string &)>>::iterator it) {
125 m_print_callbacks.erase(it);
131 void DisconnectTestLogger();
133 void ShrinkDebugFile();
138 bool EnableCategory(
const std::string &str);
139 void DisableCategory(
LogFlags category);
140 bool DisableCategory(
const std::string &str);
143 bool WillLogCategory(
LogFlags category)
const;
146 bool DefaultShrinkDebugFile()
const;
170 template <
typename... Args>
171 static inline void LogPrintf(
const char *fmt,
const Args &... args) {
180 log_msg =
"Error \"" + std::string(fmterr.what()) +
181 "\" while formatting log message: " + fmt;
189 #define LogPrint(category, ...) \ 191 if (LogAcceptCategory((category))) { \ 192 LogPrintf(__VA_ARGS__); \ 201 #define LogPrintfToBeContinued LogPrintf 202 #define LogPrintToBeContinued LogPrint 204 #endif // BITCOIN_LOGGING_H
std::list< std::function< void(const std::string &)> > m_print_callbacks GUARDED_BY(m_cs)
Slots that connect to the print signal.
static const bool DEFAULT_LOGTHREADNAMES
std::vector< CLogCategoryActive > ListActiveLogCategories()
Returns a vector of the active log categories.
static const bool DEFAULT_LOGTIMEMICROS
static void LogPrintf(const char *fmt, const Args &... args)
std::list< std::function< void(const std::string &)> >::iterator PushBackCallback(std::function< void(const std::string &)> fun)
Connect a slot to the print signal and return the connection.
BCLog::Logger & LogInstance()
void LogPrintStr(const std::string &str)
Send a string to the log output.
uint32_t GetCategoryMask() const
bool WillLogCategory(LogFlags category) const
Return true if log accepts specified category.
static bool LogAcceptCategory(BCLog::LogFlags category)
Return true if log accepts specified category.
std::string ListLogCategories()
Returns a string with the log categories.
void DeleteCallback(std::list< std::function< void(const std::string &)>>::iterator it)
Delete a connection.
bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str)
Return true if str parses as a log category and set the flag.
static const bool DEFAULT_LOGIPS
const char *const DEFAULT_DEBUGLOGFILE
bool Enabled() const
Returns whether logs will be written to any output.
static const bool DEFAULT_LOGTIMESTAMPS