1 #ifndef _midge_message_hh_ 2 #define _midge_message_hh_ 37 static const message_severity
s_error = 0;
40 static const message_severity
s_debug = 3;
47 message(
const std::string& aKey,
const std::string& aDescription,
const std::string& aPrefix,
const std::string& aSuffix );
59 void set_key(
const std::string& aKey );
60 const std::string& get_key()
const;
70 message& operator()(
const message_severity& );
72 template<
class XPr
intable >
78 void set_severity(
const message_severity& aSeverity );
122 void set_format(
const message_format& aFormat );
123 void set_precision(
const message_precision& aPrecision );
124 void set_terminal_severity(
const message_severity& aVerbosity );
125 void set_terminal_stream( std::ostream* aTerminalStream );
126 void set_log_severity(
const message_severity& aVerbosity );
127 void set_log_stream( std::ostream* aLogStream );
135 static void acquire();
136 static void release();
146 set_severity( aSeverity );
151 template<
class XPr
intable >
156 f_message_line << aFragment;
164 f_message_lines.push_back( f_message_line.str() );
165 f_message_line.clear();
166 f_message_line.str(
"" );
174 f_message_lines.push_back( f_message_line.str() );
175 f_message_line.clear();
176 f_message_line.str(
"" );
186 #include "singleton.hh" 192 public scarab::singleton< messages >
205 message*
get(
const std::string& aKey );
206 void remove(
message* aMessage );
217 void set_terminal_stream( std::ostream* aTerminalStream );
218 std::ostream* get_terminal_stream();
223 void set_log_stream( std::ostream* aLogStream );
224 std::ostream* get_log_stream();
227 typedef std::map< std::string, message* >
map_t;
230 typedef map_t::const_iterator
cit_t;
246 #define message_declare( x_name )\ 249 LOGGER( mmlog_##x_name, "x_name" );\ 264 #define message_define( x_name, x_key, x_label )\ 280 #define message_define_full( x_name, x_key, x_label, x_prefix, x_suffix )\ 299 #define msg_debug( x_name, x_content ) LDEBUG( mmlog_##x_name, x_content ); 301 #define msg_debug( x_name, x_content ) 304 #define msg_normal( x_name, x_content ) LINFO( mmlog_##x_name, x_content ); 306 #define msg_warning( x_name, x_content ) LWARN( mmlog_##x_name, x_content ); 308 #define msg_error( x_name, x_content ) LERROR( mmlog_##x_name, x_content );
message_severity f_log_severity
static const message_end eom
std::string message::* f_color_suffix
std::string f_system_suffix
std::string f_system_description
std::ostream * f_terminal_stream
std::ostream & operator<<(std::ostream &a_str, const message_line &)
std::string f_default_color_prefix
std::vector< std::string > f_message_lines
std::string f_error_description
static const message_line ret
static std::mutex f_inner
static const message_severity s_debug
std::string f_normal_color_suffix
message_severity f_terminal_severity
std::streamsize message_precision
std::string f_warning_color_suffix
static const message_severity s_error
std::string f_warning_color_prefix
map_t::value_type entry_t
std::string f_debug_color_prefix
std::stringstream f_message_line
message_severity f_log_severity
message & operator()(const message_severity &)
std::ostream * f_log_stream
std::string message::* f_description
std::ios_base::fmtflags message_format
map_t::const_iterator cit_t
static const message_severity s_normal
static const message_severity s_warning
std::string f_system_prefix
#define message_declare(x_name)
std::string f_normal_color_prefix
std::string f_normal_description
static std::set< std::thread::id > f_threads
std::string message::* f_color_prefix
message & operator<<(const XPrintable &p_fragment)
std::map< std::string, message *> map_t
message_severity f_severity
std::string f_error_color_prefix
message_severity f_terminal_severity
std::string f_default_description
std::string f_error_color_suffix
std::ostream * f_terminal_stream
std::ostream * f_log_stream
std::string f_debug_description
std::string f_default_color_suffix
message_precision f_precision
std::string f_warning_description
static std::mutex f_outer
std::string f_debug_color_suffix