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::ConversionPattern Struct Reference

A conversion pattern for message templates. More...

#include <conversion_pattern.h>

Public Types

enum  PATTERN_TYPE {
  DT = 0, FILE, FILE_ABSOLUTE, LINE,
  FUNC, HOST, THREADID, MSG,
  LVL
}
 Identifiers for patterns supported by ealogger. More...
 

Public Member Functions

 ConversionPattern (std::string conv_pattern, const PATTERN_TYPE ptype)
 Constructor for the a conversion pattern. More...
 
template<typename T >
void replace_conversion_pattern (std::string &msg, T new_value) const
 Replace conversion pattern with new_value. More...
 
ConversionPattern::PATTERN_TYPE get_pattern_type () const
 Get the conversion pattern type. More...
 
template<>
void replace_conversion_pattern (std::string &msg, std::string new_value) const
 Replace conversion pattern with new_value. More...
 

Detailed Description

A conversion pattern for message templates.

ealogger supports several conversion patterns that let you substitude a pattern within a string with an appropriate value. This way the style of the log messages can be set for each log sink. Currently we support these conversion patterns

d : Date Time as provided f : Name of the file from where a log message was issued F : Absolut path of a file as provided by FILE from where a log message was issued l : Line number of the file from where a log message was issued (LINE) u : Name of the function from where a log message was issued (func) h : Hostname t : Thread ID m : Log message s : Log level / severity

Member Enumeration Documentation

Identifiers for patterns supported by ealogger.

Enumerator
DT 

Datetime Pattern

FILE 

Caller Filename

FILE_ABSOLUTE 

Caller absolute filename

LINE 

Line number

FUNC 

Caller Function

HOST 

Hostname

THREADID 

Thread ID

MSG 

Log Message

LVL 

Log level/severity

Constructor & Destructor Documentation

ealogger::ConversionPattern::ConversionPattern ( std::string  conv_pattern,
const PATTERN_TYPE  ptype 
)
inline

Constructor for the a conversion pattern.

Parameters
conv_patternThe conversion pattern
ptypeconversion pattern identifier

Member Function Documentation

ConversionPattern::PATTERN_TYPE ealogger::ConversionPattern::get_pattern_type ( ) const
inline

Get the conversion pattern type.

Returns
Conversion pattern identifier
template<typename T >
void ealogger::ConversionPattern::replace_conversion_pattern ( std::string &  msg,
new_value 
) const
inline

Replace conversion pattern with new_value.

Parameters
msgMessage template reference
new_valueValue to replace all occurences of the conversion pattern with
template<>
void ealogger::ConversionPattern::replace_conversion_pattern ( std::string &  msg,
std::string  new_value 
) const
inline

Replace conversion pattern with new_value.

Parameters
msgThe message pattern
new_valueNew value

This method is a specialization of ConversionPattern::replace_conversion_pattern(std::string, T) Here the actual replacement of all occurences of the conversion pattern with a dedicated value takes place.


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