#include <threadsafety.h>
#include <tinyformat.h>
#include <util/fs.h>
#include <util/string.h>
#include <atomic>
#include <cstdint>
#include <functional>
#include <list>
#include <mutex>
#include <string>
Go to the source code of this file.
|
#define | LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__) |
|
#define | LogPrintf(...) LogPrintLevel_(BCLog::LogFlags::NONE, BCLog::Level::None, __VA_ARGS__) |
|
#define | LogPrintfCategory(category, ...) LogPrintLevel_(category, BCLog::Level::None, __VA_ARGS__) |
|
#define | LogPrint(category, ...) |
|
#define | LogPrintLevel(category, level, ...) |
|
#define | LogPrintfToBeContinued LogPrintf |
| These are aliases used to explicitly state that the message should not end with a newline character. More...
|
|
#define | LogPrintToBeContinued LogPrint |
|
#define | LogPrintLevelToBeContinued LogPrintLevel |
|
|
enum | BCLog::LogFlags : uint32_t {
BCLog::NONE = 0
, BCLog::NET = (1 << 0)
, BCLog::TOR = (1 << 1)
, BCLog::MEMPOOL = (1 << 2)
,
BCLog::HTTP = (1 << 3)
, BCLog::BENCH = (1 << 4)
, BCLog::ZMQ = (1 << 5)
, BCLog::WALLETDB = (1 << 6)
,
BCLog::RPC = (1 << 7)
, BCLog::ESTIMATEFEE = (1 << 8)
, BCLog::ADDRMAN = (1 << 9)
, BCLog::SELECTCOINS = (1 << 10)
,
BCLog::REINDEX = (1 << 11)
, BCLog::CMPCTBLOCK = (1 << 12)
, BCLog::RAND = (1 << 13)
, BCLog::PRUNE = (1 << 14)
,
BCLog::PROXY = (1 << 15)
, BCLog::MEMPOOLREJ = (1 << 16)
, BCLog::LIBEVENT = (1 << 17)
, BCLog::COINDB = (1 << 18)
,
BCLog::QT = (1 << 19)
, BCLog::LEVELDB = (1 << 20)
, BCLog::VALIDATION = (1 << 21)
, BCLog::AVALANCHE = (1 << 22)
,
BCLog::I2P = (1 << 23)
, BCLog::CHRONIK = (1 << 24)
, BCLog::BLOCKSTORE = (1 << 26)
, BCLog::NETDEBUG = (1 << 27)
,
BCLog::TXPACKAGES = (1 << 28)
, BCLog::ALL = ~uint32_t(0)
} |
|
enum class | BCLog::Level {
BCLog::Debug = 0
, BCLog::None = 1
, BCLog::Info = 2
, BCLog::Warning = 3
,
BCLog::Error = 4
} |
|
|
BCLog::Logger & | LogInstance () |
|
static bool | LogAcceptCategory (BCLog::LogFlags category, BCLog::Level level) |
| Return true if log accepts specified category, at the specified level. More...
|
|
bool | GetLogCategory (BCLog::LogFlags &flag, const std::string &str) |
| Return true if str parses as a log category and set the flag. More...
|
|
template<typename... Args> |
static void | LogPrintf_ (const std::string &logging_function, const std::string &source_file, const int source_line, const BCLog::LogFlags flag, const BCLog::Level level, const char *fmt, const Args &...args) |
|
template<typename... Args> |
bool | error (const char *fmt, const Args &...args) |
|
◆ LogPrint
#define LogPrint |
( |
|
category, |
|
|
|
... |
|
) |
| |
Value: do { \
} \
} while (0)
static bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
Return true if log accepts specified category, at the specified level.
Definition at line 238 of file logging.h.
◆ LogPrintf
◆ LogPrintfCategory
◆ LogPrintfToBeContinued
These are aliases used to explicitly state that the message should not end with a newline character.
It allows for detecting the missing newlines that could make the logs hard to read.
Definition at line 259 of file logging.h.
◆ LogPrintLevel
#define LogPrintLevel |
( |
|
category, |
|
|
|
level, |
|
|
|
... |
|
) |
| |
Value: do { \
LogPrintLevel_(category, level, __VA_ARGS__); \
} \
} while (0)
Definition at line 247 of file logging.h.
◆ LogPrintLevel_
#define LogPrintLevel_ |
( |
|
category, |
|
|
|
level, |
|
|
|
... |
|
) |
| LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__) |
◆ LogPrintLevelToBeContinued
◆ LogPrintToBeContinued
◆ error()
template<typename... Args>
bool error |
( |
const char * |
fmt, |
|
|
const Args &... |
args |
|
) |
| |
◆ GetLogCategory()
Return true if str parses as a log category and set the flag.
Definition at line 158 of file logging.cpp.
◆ LogAcceptCategory()
Return true if log accepts specified category, at the specified level.
Definition at line 186 of file logging.h.
◆ LogInstance()
NOTE: the logger instance is leaked on exit. This is ugly, but will be cleaned up by the OS/libc. Defining a logger as a global object doesn't work since the order of destruction of static/global objects is undefined. Consider if the logger gets destroyed, and then some later destructor calls LogPrintf, maybe indirectly, and you get a core dump at shutdown trying to access the logger. When the shutdown sequence is fully audited and tested, explicit destruction of these objects can be implemented by changing this from a raw pointer to a std::unique_ptr. Since the ~Logger() destructor is never called, the Logger class and all its subclasses must have implicitly-defined destructors.
This method of initialization was originally introduced in ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c.
Definition at line 21 of file logging.cpp.
◆ LogPrintf_()
template<typename... Args>
static void LogPrintf_ |
( |
const std::string & |
logging_function, |
|
|
const std::string & |
source_file, |
|
|
const int |
source_line, |
|
|
const BCLog::LogFlags |
flag, |
|
|
const BCLog::Level |
level, |
|
|
const char * |
fmt, |
|
|
const Args &... |
args |
|
) |
| |
|
inlinestatic |
Original format string will have newline so don't add one here
Definition at line 204 of file logging.h.
◆ DEFAULT_DEBUGLOGFILE
const char* const DEFAULT_DEBUGLOGFILE |
|
extern |
◆ DEFAULT_LOGIPS
const bool DEFAULT_LOGIPS = false |
|
static |
◆ DEFAULT_LOGSOURCELOCATIONS
const bool DEFAULT_LOGSOURCELOCATIONS = false |
|
static |
◆ DEFAULT_LOGTHREADNAMES
const bool DEFAULT_LOGTHREADNAMES = false |
|
static |
◆ DEFAULT_LOGTIMEMICROS
const bool DEFAULT_LOGTIMEMICROS = false |
|
static |
◆ DEFAULT_LOGTIMESTAMPS
const bool DEFAULT_LOGTIMESTAMPS = true |
|
static |
◆ fLogIPs