presage  0.9.2~beta
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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.

◆ 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.

◆ ~Logger()

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

Definition at line 104 of file logger.h.

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.

Referenced by endl().

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.

◆ 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.

◆ 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.

Referenced by Logger< char >::Logger().

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 185 of file logger.h.

◆ 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.

◆ 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.

Referenced by Logger< char >::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.

◆ 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.

Referenced by Logger< char >::operator<<().

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.

◆ 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.

Referenced by SmoothedNgramPredictor::check_learn_consistency(), Logger< char >::endl(), and SmoothedNgramPredictor::predict().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<< [1/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

Definition at line 158 of file logger.h.

◆ operator<< [2/2]

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

Definition at line 177 of file logger.h.

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 Logger< char >::init(), and Logger< char >::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 Logger< char >::endl(), and Logger< char >::~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: