BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
Classes | Functions | Variables
logging.cpp File Reference
#include <logging.h>
#include <utiltime.h>
Include dependency graph for logging.cpp:

Go to the source code of this file.

Classes

struct  CLogCategoryDesc
 

Functions

bool GetLogCategory (BCLog::LogFlags &flag, const std::string &str)
 Return true if str parses as a log category and set the flag. More...
 
std::string ListLogCategories ()
 Returns a string with the log categories. More...
 
std::vector< CLogCategoryActiveListActiveLogCategories ()
 Returns a vector of the active log categories. More...
 

Variables

const char *const DEFAULT_DEBUGLOGFILE = "debug.log"
 
BCLog::Logger *const g_logger = new BCLog::Logger()
 NOTE: the logger instances is leaked on exit. More...
 
bool fLogIPs = DEFAULT_LOGIPS
 
const CLogCategoryDesc LogCategories []
 

Function Documentation

◆ GetLogCategory()

bool GetLogCategory ( BCLog::LogFlags flag,
const std::string &  str 
)

Return true if str parses as a log category and set the flag.

Definition at line 126 of file logging.cpp.

Here is the caller graph for this function:

◆ ListActiveLogCategories()

std::vector<CLogCategoryActive> ListActiveLogCategories ( )

Returns a vector of the active log categories.

Definition at line 156 of file logging.cpp.

◆ ListLogCategories()

std::string ListLogCategories ( )

Returns a string with the log categories.

Definition at line 141 of file logging.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ DEFAULT_DEBUGLOGFILE

const char* const DEFAULT_DEBUGLOGFILE = "debug.log"

Definition at line 9 of file logging.cpp.

◆ fLogIPs

bool fLogIPs = DEFAULT_LOGIPS

Definition at line 26 of file logging.cpp.

◆ g_logger

BCLog::Logger* const g_logger = new BCLog::Logger()

NOTE: the logger instances 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.

This method of initialization was originally introduced in ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c.

Definition at line 24 of file logging.cpp.

◆ LogCategories

const CLogCategoryDesc LogCategories[]
Initial value:
=
{
{BCLog::NONE, "0"},
{BCLog::NONE, "none"},
{BCLog::NET, "net"},
{BCLog::TOR, "tor"},
{BCLog::MEMPOOL, "mempool"},
{BCLog::HTTP, "http"},
{BCLog::BENCH, "bench"},
{BCLog::ZMQ, "zmq"},
{BCLog::DB, "db"},
{BCLog::RPC, "rpc"},
{BCLog::ESTIMATEFEE, "estimatefee"},
{BCLog::ADDRMAN, "addrman"},
{BCLog::SELECTCOINS, "selectcoins"},
{BCLog::REINDEX, "reindex"},
{BCLog::CMPCTBLOCK, "cmpctblock"},
{BCLog::RAND, "rand"},
{BCLog::PRUNE, "prune"},
{BCLog::PROXY, "proxy"},
{BCLog::MEMPOOLREJ, "mempoolrej"},
{BCLog::LIBEVENT, "libevent"},
{BCLog::COINDB, "coindb"},
{BCLog::QT, "qt"},
{BCLog::LEVELDB, "leveldb"},
{BCLog::ALL, "1"},
{BCLog::ALL, "all"},
}

Definition at line 97 of file logging.cpp.