Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::logger Class Reference

#include <logger.hpp>

Classes

class  impl
 

Public Member Functions

 logger ()
 
 logger (const string &name, const logger &parent=nullptr)
 
 logger (std::nullptr_t)
 
 logger (const logger &c)
 
 logger (logger &&c)
 
 ~logger ()
 
loggeroperator= (const logger &)
 
loggeroperator= (logger &&)
 
loggerset_log_level (log_level e)
 
log_level get_log_level () const
 
loggerset_parent (const logger &l)
 
logger get_parent () const
 
void set_name (const fc::string &n)
 
const fc::stringname () const
 
bool is_enabled (log_level e) const
 
void log (log_message m)
 

Static Public Member Functions

static logger get (const fc::string &name=DEFAULT_LOGGER)
 
static void update (const fc::string &name, logger &log)
 

Friends

struct log_config
 
bool operator== (const logger &, nullptr_t)
 
bool operator!= (const logger &, nullptr_t)
 

Detailed Description

void my_class::func()
{
fc_dlog( my_class_logger, "Format four: ${arg} five: ${five}", ("arg",4)("five",5) );
}
#define fc_dlog(LOGGER, FORMAT,...)
Definition logger.hpp:77

Definition at line 25 of file logger.hpp.

Constructor & Destructor Documentation

◆ logger() [1/5]

fc::logger::logger ( )

Definition at line 26 of file logger.cpp.

27 :my( new impl() ){}

◆ logger() [2/5]

fc::logger::logger ( const string & name,
const logger & parent = nullptr )

Definition at line 31 of file logger.cpp.

32 :my( new impl() )
33 {
34 my->_name = name;
35 my->_parent = parent;
36 }
const fc::string & name() const
Definition logger.cpp:86
Here is the call graph for this function:

◆ logger() [3/5]

fc::logger::logger ( std::nullptr_t )

◆ logger() [4/5]

fc::logger::logger ( const logger & c)

Definition at line 39 of file logger.cpp.

40 :my(l.my){}
int l

◆ logger() [5/5]

fc::logger::logger ( logger && c)

Definition at line 42 of file logger.cpp.

43 :my(fc::move(l.my)){}

◆ ~logger()

fc::logger::~logger ( )

Definition at line 45 of file logger.cpp.

45{}

Member Function Documentation

◆ get()

logger fc::logger::get ( const fc::string & name = DEFAULT_LOGGER)
static

Definition at line 88 of file logger.cpp.

88 {
89 return log_config::get_logger( s );
90 }
static logger get_logger(const fc::string &name)
char * s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_log_level()

log_level fc::logger::get_log_level ( ) const

Definition at line 99 of file logger.cpp.

99{ return my->_level; }
Here is the caller graph for this function:

◆ get_parent()

logger fc::logger::get_parent ( ) const

Definition at line 96 of file logger.cpp.

96{ return my->_parent; }

◆ is_enabled()

bool fc::logger::is_enabled ( log_level e) const

Definition at line 58 of file logger.cpp.

58 {
59 return e >= my->_level;
60 }
Here is the caller graph for this function:

◆ log()

void fc::logger::log ( log_message m)

Definition at line 62 of file logger.cpp.

62 {
63 std::unique_lock g( log_config::get().log_mutex );
64 m.get_context().append_context( my->_name );
65
66 for( auto itr = my->_appenders.begin(); itr != my->_appenders.end(); ++itr ) {
67 try {
68 (*itr)->log( m );
69 } catch( fc::exception& er ) {
70 std::cerr << "ERROR: logger::log fc::exception: " << er.to_detail_string() << std::endl;
71 } catch( const std::exception& e ) {
72 std::cerr << "ERROR: logger::log std::exception: " << e.what() << std::endl;
73 } catch( ... ) {
74 std::cerr << "ERROR: logger::log unknown exception: " << std::endl;
75 }
76 }
77
78 if( my->_additivity && my->_parent != nullptr) {
79 logger parent = my->_parent;
80 g.unlock();
81 parent.log( m );
82 }
83 }
Used to generate a useful error report when an exception is thrown.
Definition exception.hpp:58
std::string to_detail_string(log_level ll=log_level::all) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

const fc::string & fc::logger::name ( ) const

Definition at line 86 of file logger.cpp.

86{ return my->_name; }
Here is the caller graph for this function:

◆ operator=() [1/2]

logger & fc::logger::operator= ( const logger & l)

Definition at line 47 of file logger.cpp.

47 {
48 my = l.my;
49 return *this;
50 }

◆ operator=() [2/2]

logger & fc::logger::operator= ( logger && l)

Definition at line 51 of file logger.cpp.

51 {
52 fc_swap(my,l.my);
53 return *this;
54 }
void fc_swap(T &a, T &b)
Definition utility.hpp:211
Here is the call graph for this function:

◆ set_log_level()

logger & fc::logger::set_log_level ( log_level e)

Definition at line 100 of file logger.cpp.

100{ my->_level = ll; return *this; }
Here is the caller graph for this function:

◆ set_name()

void fc::logger::set_name ( const fc::string & n)

Definition at line 85 of file logger.cpp.

85{ my->_name = n; }

◆ set_parent()

logger & fc::logger::set_parent ( const logger & l)

Definition at line 97 of file logger.cpp.

97{ my->_parent = p; return *this; }
const mie::Vuint & p
Definition bn.cpp:27

◆ update()

void fc::logger::update ( const fc::string & name,
logger & log )
static

Definition at line 92 of file logger.cpp.

92 {
94 }
static void update_logger(const fc::string &name, logger &log)
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ log_config

friend struct log_config
friend

Definition at line 54 of file logger.hpp.

◆ operator!=

bool operator!= ( const logger & ,
nullptr_t  )
friend

◆ operator==

bool operator== ( const logger & ,
nullptr_t  )
friend

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