BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
BCLog::Logger Class Reference

#include <logging.h>

Public Member Functions

void LogPrintStr (const std::string &str)
 Send a string to the log output. More...
 
bool Enabled () const
 Returns whether logs will be written to any output. More...
 
bool OpenDebugLog ()
 
void ShrinkDebugFile ()
 
uint32_t GetCategoryMask () const
 
void EnableCategory (LogFlags flag)
 
bool EnableCategory (const std::string &str)
 
void DisableCategory (LogFlags flag)
 
bool DisableCategory (const std::string &str)
 
bool WillLogCategory (LogFlags category) const
 
bool DefaultShrinkDebugFile () const
 

Public Attributes

bool m_print_to_console = false
 
bool m_print_to_file = false
 
bool m_log_timestamps = DEFAULT_LOGTIMESTAMPS
 
bool m_log_time_micros = DEFAULT_LOGTIMEMICROS
 
fs::path m_file_path
 
std::atomic< bool > m_reopen_file {false}
 

Private Member Functions

std::string LogTimestampStr (const std::string &str)
 

Private Attributes

FILE * m_fileout = nullptr
 
std::mutex m_file_mutex
 
std::list< std::string > m_msgs_before_open
 
std::atomic_bool m_started_new_line {true}
 m_started_new_line is a state variable that will suppress printing of the timestamp when multiple calls are made that don't end in a newline. More...
 
std::atomic< uint32_t > m_categories {0}
 Log categories bitfield. More...
 

Detailed Description

Definition at line 59 of file logging.h.

Member Function Documentation

◆ DefaultShrinkDebugFile()

bool BCLog::Logger::DefaultShrinkDebugFile ( ) const

Definition at line 86 of file logging.cpp.

Here is the caller graph for this function:

◆ DisableCategory() [1/2]

void BCLog::Logger::DisableCategory ( BCLog::LogFlags  flag)

Definition at line 68 of file logging.cpp.

◆ DisableCategory() [2/2]

bool BCLog::Logger::DisableCategory ( const std::string &  str)

Definition at line 73 of file logging.cpp.

Here is the call graph for this function:

◆ EnableCategory() [1/2]

void BCLog::Logger::EnableCategory ( BCLog::LogFlags  flag)

Definition at line 55 of file logging.cpp.

◆ EnableCategory() [2/2]

bool BCLog::Logger::EnableCategory ( const std::string &  str)

Definition at line 60 of file logging.cpp.

Here is the call graph for this function:

◆ Enabled()

bool BCLog::Logger::Enabled ( ) const
inline

Returns whether logs will be written to any output.

Definition at line 92 of file logging.h.

◆ GetCategoryMask()

uint32_t BCLog::Logger::GetCategoryMask ( ) const
inline

Definition at line 97 of file logging.h.

Here is the caller graph for this function:

◆ LogPrintStr()

void BCLog::Logger::LogPrintStr ( const std::string &  str)

Send a string to the log output.

Definition at line 201 of file logging.cpp.

Here is the call graph for this function:

◆ LogTimestampStr()

std::string BCLog::Logger::LogTimestampStr ( const std::string &  str)
private

Definition at line 171 of file logging.cpp.

Here is the call graph for this function:

◆ OpenDebugLog()

bool BCLog::Logger::OpenDebugLog ( )

Definition at line 33 of file logging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShrinkDebugFile()

void BCLog::Logger::ShrinkDebugFile ( )

Definition at line 234 of file logging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WillLogCategory()

bool BCLog::Logger::WillLogCategory ( BCLog::LogFlags  category) const

Definition at line 81 of file logging.cpp.

Member Data Documentation

◆ m_categories

std::atomic<uint32_t> BCLog::Logger::m_categories {0}
private

Log categories bitfield.

Definition at line 74 of file logging.h.

◆ m_file_mutex

std::mutex BCLog::Logger::m_file_mutex
private

Definition at line 63 of file logging.h.

◆ m_file_path

fs::path BCLog::Logger::m_file_path

Definition at line 85 of file logging.h.

◆ m_fileout

FILE* BCLog::Logger::m_fileout = nullptr
private

Definition at line 62 of file logging.h.

◆ m_log_time_micros

bool BCLog::Logger::m_log_time_micros = DEFAULT_LOGTIMEMICROS

Definition at line 83 of file logging.h.

◆ m_log_timestamps

bool BCLog::Logger::m_log_timestamps = DEFAULT_LOGTIMESTAMPS

Definition at line 82 of file logging.h.

◆ m_msgs_before_open

std::list<std::string> BCLog::Logger::m_msgs_before_open
private

Definition at line 64 of file logging.h.

◆ m_print_to_console

bool BCLog::Logger::m_print_to_console = false

Definition at line 79 of file logging.h.

◆ m_print_to_file

bool BCLog::Logger::m_print_to_file = false

Definition at line 80 of file logging.h.

◆ m_reopen_file

std::atomic<bool> BCLog::Logger::m_reopen_file {false}

Definition at line 86 of file logging.h.

◆ m_started_new_line

std::atomic_bool BCLog::Logger::m_started_new_line {true}
private

m_started_new_line is a state variable that will suppress printing of the timestamp when multiple calls are made that don't end in a newline.

Definition at line 71 of file logging.h.


The documentation for this class was generated from the following files: