ealogger
ealogger is a c++ library that provides a blazing fast and easy to use logging mechanism
Public Types | Public Member Functions | List of all members
ealogger::LogMessage Struct Reference

Log message struct. More...

#include <logmessage.h>

Public Types

enum  LOGTYPE { DEFAULT = 0, STACK }
 The LOGTYPE enum stands for the LogMessage type. More...
 
typedef std::vector< std::string >::const_iterator msg_vec_it
 A constant iterator typedef that is internally used.
 

Public Member Functions

 LogMessage (ealogger::constants::LOG_LEVEL severity, std::string message, LOGTYPE log_type, std::string file, int lnumber, std::string func)
 Initializes a log message object. More...
 
 LogMessage (ealogger::constants::LOG_LEVEL severity, std::vector< std::string > message_vec, LOGTYPE log_type, std::string file, int lnumber, std::string func)
 Initializes a log message object with a vector of message strings. More...
 
std::time_t get_timepoint ()
 Return the time_point when this message was created. More...
 
ealogger::constants::LOG_LEVEL get_severity ()
 Returns the severity of the message. More...
 
std::string get_message ()
 Get the log message. More...
 
LOGTYPE get_log_type ()
 Get the log message type. More...
 
msg_vec_it get_msg_vec_begin ()
 Returns a constant iterator pointing the begin of the message vector. More...
 
msg_vec_it get_msg_vec_end ()
 Returns a constant iterator pointing the end of the message vector. More...
 
std::string get_call_file ()
 Return file from where this log message was issued. More...
 
int get_call_file_line ()
 Return line number in file from where this log message was issued. More...
 
std::string get_call_func ()
 Return function name from where this log message was issued. More...
 

Detailed Description

Log message struct.

A log message in ealogger stores lots of information besides the message string a user has provided.

First of all there are two types of messages in ealogger. LogMessage::LOGTYPE has two members. STACK messages are messages that are containing a stacktrace.

Additionally a LogMessage stores the message severity, the file from where the message was issued as well as the line number and the function name. All these properties are exposed with appropriate getter functions.

Member Enumeration Documentation

The LOGTYPE enum stands for the LogMessage type.

Enumerator
DEFAULT 

Normal log message

STACK 

Log message with a vector of stack elements

Constructor & Destructor Documentation

ealogger::LogMessage::LogMessage ( ealogger::constants::LOG_LEVEL  severity,
std::string  message,
LOGTYPE  log_type,
std::string  file,
int  lnumber,
std::string  func 
)
inline

Initializes a log message object.

Parameters
severitySeverity of the message
messageMessage as std::string
log_typeLogMessage::LOGTYPE
fileFile from where this log message was issued
lnumberLine number in file from where this log message was issued
funcFunction from where this log message was issued
ealogger::LogMessage::LogMessage ( ealogger::constants::LOG_LEVEL  severity,
std::vector< std::string >  message_vec,
LOGTYPE  log_type,
std::string  file,
int  lnumber,
std::string  func 
)
inline

Initializes a log message object with a vector of message strings.

Parameters
severitySeverity of the message
message_vecA vector<std::string> containing the stack elements
log_typeLogMessage::LOGTYPE
fileFile from where this log message was issued
lnumberLine number in file from where this log message was issued
funcFunction from where this log message was issued

Member Function Documentation

std::string ealogger::LogMessage::get_call_file ( )
inline

Return file from where this log message was issued.

Returns
int ealogger::LogMessage::get_call_file_line ( )
inline

Return line number in file from where this log message was issued.

Returns
std::string ealogger::LogMessage::get_call_func ( )
inline

Return function name from where this log message was issued.

Returns
LOGTYPE ealogger::LogMessage::get_log_type ( )
inline

Get the log message type.

Returns
LogMessage::LOGTYPE
std::string ealogger::LogMessage::get_message ( )
inline

Get the log message.

Returns
Log message as std::string
msg_vec_it ealogger::LogMessage::get_msg_vec_begin ( )
inline

Returns a constant iterator pointing the begin of the message vector.

Returns
msg_vec_it
msg_vec_it ealogger::LogMessage::get_msg_vec_end ( )
inline

Returns a constant iterator pointing the end of the message vector.

Returns
msg_vec_it
ealogger::constants::LOG_LEVEL ealogger::LogMessage::get_severity ( )
inline

Returns the severity of the message.

Returns
Return severity
std::time_t ealogger::LogMessage::get_timepoint ( )
inline

Return the time_point when this message was created.

Returns
std::time_t object

The documentation for this struct was generated from the following file: