Bitcoin ABC 0.26.3
P2P Digital Currency
|
#include <logging.h>
#include <util/fs.h>
#include <util/string.h>
#include <util/threadnames.h>
#include <util/time.h>
#include <array>
#include <map>
#include <unordered_map>
Go to the source code of this file.
Namespaces | |
namespace | BCLog |
Functions | |
BCLog::Logger & | LogInstance () |
static int | FileWriteStr (const std::string &str, FILE *fp) |
bool | GetLogCategory (BCLog::LogFlags &flag, const std::string &str) |
Return true if str parses as a log category and set the flag. | |
std::string | LogLevelToStr (BCLog::Level level) |
std::string | LogCategoryToStr (BCLog::LogFlags category) |
std::string | BCLog::LogEscapeMessage (const std::string &str) |
Belts and suspenders: make sure outgoing log messages don't contain potentially suspicious characters, such as terminal control codes. | |
Variables | |
bool | fLogIPs = DEFAULT_LOGIPS |
const char *const | DEFAULT_DEBUGLOGFILE = "debug.log" |
static const std::map< std::string, BCLog::LogFlags > | LOG_CATEGORIES_BY_STR |
static const std::unordered_map< BCLog::LogFlags, std::string > | LOG_CATEGORIES_BY_FLAG |
Definition at line 41 of file logging.cpp.
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 158 of file logging.cpp.
std::string LogCategoryToStr | ( | BCLog::LogFlags | category | ) |
Definition at line 187 of file logging.cpp.
BCLog::Logger & 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.
std::string LogLevelToStr | ( | BCLog::Level | level | ) |
Definition at line 171 of file logging.cpp.
const char* const DEFAULT_DEBUGLOGFILE = "debug.log" |
Definition at line 19 of file logging.cpp.
bool fLogIPs = DEFAULT_LOGIPS |
Definition at line 18 of file logging.cpp.
|
static |
Definition at line 139 of file logging.cpp.
|
static |
Definition at line 100 of file logging.cpp.