presage 0.9.1
Logger< _charT, _Traits > Class Template Reference

#include <logger.h>

Inheritance diagram for Logger< _charT, _Traits >:
Inheritance graph
Collaboration diagram for Logger< _charT, _Traits >:
Collaboration graph

Classes

class  LoggerState

Public Types

enum  Level {
  EMERG = 0 , FATAL = 0 , ALERT = 100 , CRIT = 200 ,
  ERROR = 300 , WARN = 400 , NOTICE = 500 , INFO = 600 ,
  DEBUG = 700 , ALL = 800
}

Public Member Functions

 Logger (std::string logger_name, std::basic_ostream< _charT, _Traits > &ostr)
 Logger (std::string logger_name, std::basic_ostream< _charT, _Traits > &ostr, const std::string &lvl)
void init (const std::string &name, const std::string &lvl)
 ~Logger ()
void setLevel (const std::string &lvl) const
void setLevel (Level lvl) const
Level getLevel () const
void setCurrentLevel (Level lvl) const
Level getCurrentLevel () const
bool shouldLog () const
const Loggeroperator<< (_SetLevel __l) const
void endl () const

Private Member Functions

void set (Level &level, const std::string &lvl) const
void set_name (const std::string &logger_name)

Private Attributes

std::string name
std::basic_ostream< _charT, _Traits > & outstream
LoggerStatestate

Friends

template<typename T>
const Loggeroperator<< (const Logger &lgr, const T &msg)
const Loggeroperator<< (const Logger &lgr, const Logger &(*fp)(const Logger &))

Detailed Description

template<class _charT, class _Traits = std::char_traits<_charT>>
class Logger< _charT, _Traits >

Definition at line 56 of file logger.h.

Member Enumeration Documentation

◆ Level

template<class _charT, class _Traits = std::char_traits<_charT>>
enum Logger::Level
Enumerator
EMERG 
FATAL 
ALERT 
CRIT 
ERROR 
WARN 
NOTICE 
INFO 
DEBUG 
ALL 

Definition at line 60 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
Logger< _charT, _Traits >::Logger ( std::string logger_name,
std::basic_ostream< _charT, _Traits > & ostr )
inline

Definition at line 76 of file logger.h.

References init(), and outstream.

Referenced by operator<<(), operator<<, and operator<<.

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

◆ Logger() [2/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
Logger< _charT, _Traits >::Logger ( std::string logger_name,
std::basic_ostream< _charT, _Traits > & ostr,
const std::string & lvl )
inline

Definition at line 84 of file logger.h.

References init(), and outstream.

Here is the call graph for this function:

◆ ~Logger()

template<class _charT, class _Traits = std::char_traits<_charT>>
Logger< _charT, _Traits >::~Logger ( )
inline

Definition at line 104 of file logger.h.

References outstream, and state.

Member Function Documentation

◆ endl()

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::endl ( ) const
inline

Definition at line 192 of file logger.h.

References outstream, shouldLog(), and state.

Referenced by endl().

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

◆ getCurrentLevel()

template<class _charT, class _Traits = std::char_traits<_charT>>
Level Logger< _charT, _Traits >::getCurrentLevel ( ) const
inline

Definition at line 142 of file logger.h.

References state.

◆ getLevel()

template<class _charT, class _Traits = std::char_traits<_charT>>
Level Logger< _charT, _Traits >::getLevel ( ) const
inline

Definition at line 128 of file logger.h.

References state.

◆ init()

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::init ( const std::string & name,
const std::string & lvl )
inline

Definition at line 93 of file logger.h.

References name, set(), set_name(), and state.

Referenced by Logger(), and Logger().

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

◆ operator<<()

template<class _charT, class _Traits = std::char_traits<_charT>>
const Logger & Logger< _charT, _Traits >::operator<< ( _SetLevel __l) const
inline

Definition at line 184 of file logger.h.

References _SetLevel::_level, Logger(), and setLevel().

Here is the call graph for this function:

◆ set()

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::set ( Level & level,
const std::string & lvl ) const
inlineprivate

Definition at line 205 of file logger.h.

References ALERT, ALL, CRIT, DEBUG, EMERG, ERROR, FATAL, INFO, NOTICE, and WARN.

Referenced by init(), and setLevel().

Here is the caller graph for this function:

◆ set_name()

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::set_name ( const std::string & logger_name)
inlineprivate

Definition at line 234 of file logger.h.

References name.

Referenced by init().

Here is the caller graph for this function:

◆ setCurrentLevel()

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::setCurrentLevel ( Level lvl) const
inline

Definition at line 135 of file logger.h.

References state.

◆ setLevel() [1/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::setLevel ( const std::string & lvl) const
inline

Definition at line 114 of file logger.h.

References set(), and state.

Referenced by operator<<().

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

◆ setLevel() [2/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
void Logger< _charT, _Traits >::setLevel ( Level lvl) const
inline

Definition at line 121 of file logger.h.

References state.

◆ shouldLog()

template<class _charT, class _Traits = std::char_traits<_charT>>
bool Logger< _charT, _Traits >::shouldLog ( ) const
inline

Definition at line 149 of file logger.h.

References state.

Referenced by endl(), and operator<<.

Here is the caller graph for this function:

◆ operator<< [1/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
const Logger & operator<< ( const Logger< _charT, _Traits > & lgr,
const Logger< _charT, _Traits > &(* fp )(const Logger< _charT, _Traits > &) )
friend

Definition at line 176 of file logger.h.

References Logger().

◆ operator<< [2/2]

template<class _charT, class _Traits = std::char_traits<_charT>>
template<typename T>
const Logger & operator<< ( const Logger< _charT, _Traits > & lgr,
const T & msg )
friend

Member Data Documentation

◆ name

template<class _charT, class _Traits = std::char_traits<_charT>>
std::string Logger< _charT, _Traits >::name
private

Definition at line 239 of file logger.h.

Referenced by init(), operator<<, and set_name().

◆ outstream

template<class _charT, class _Traits = std::char_traits<_charT>>
std::basic_ostream<_charT, _Traits>& Logger< _charT, _Traits >::outstream
private

Definition at line 240 of file logger.h.

Referenced by endl(), Logger(), Logger(), operator<<, and ~Logger().

◆ state

template<class _charT, class _Traits = std::char_traits<_charT>>
LoggerState* Logger< _charT, _Traits >::state
private

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