Tomographer  v1.0a
Tomographer C++ Framework Documentation
Tomographer::Logger::LogLevel Class Reference

Object which stores a log level and can initialize from a string. More...

#include <tomographer/tools/loggers.h>

Public Member Functions

 LogLevel (int level_=INFO)
 Construct a level using an integer level code. See LogLevelCode.
 
 LogLevel (const char *s)
 Construct a level using a string level name.
 
 LogLevel (const std::string &s)
 Construct a level using a string level name.
 
int level () const
 Get the stored level code. See LogLevelCode.
 
 operator int () const
 This class is implicitly convertible to an int.
 
std::string levelname () const
 Get the stored level name.
 
void setlevel (int level)
 Set the level to the given level code. See class doc and LogLevelCode.
 
void setlevel (std::string s)
 Set the level to the given level name. See class doc.
 

Detailed Description

Object which stores a log level and can initialize from a string.

The only valid levels are LONGDEBUG, DEBUG, INFO, WARNING and ERROR. Any attempt to store any other integer value, or to assign any other string will result in an std::invalid_argument exception.

The acceptable strings are "LONGDEBUG", "DEBUG", "INFO", "WARNING" and "ERROR". They are parsed case-insensitive.

This may be used as type for one of Boost's Programs Options type, for example.

This class has also C++ i/ostream operators defined, which parse and write the level name as a std::string.

Definition at line 156 of file loggers.h.


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