|
EvolvingObjects
|
eoLogger Class providing a verbose management through EO Use of a global variable eo::log to easily use the logger like std::cout More...
#include <eoLogger.h>
Classes | |
| class | outbuf |
| outbuf this class inherits from std::streambuf which is used by eoLogger to write the buffer in an output stream More... | |
Public Member Functions | |
| eoLogger () | |
| default ctor | |
| eoLogger (eo::file file) | |
| overidded ctor in order to instanciate a logger with a file define in parameter | |
| ~eoLogger () | |
| dtor | |
| virtual std::string | className () const |
| common function for all eo objects | |
| void | printLevels () const |
| Print the available levels on the standard output enablable with the option -l. | |
| eo::Levels | getLevelSelected () const |
| eo::Levels | getLevelContext () const |
Protected Member Functions | |
| void | addLevel (std::string name, eo::Levels level) |
| in order to add a level of verbosity | |
Private Types | |
|
typedef std::map< std::string, eo::Levels > | MapLevel |
| MapLevel is the type used by the map member _levels. | |
Private Member Functions | |
| void | _createParameters (eoParser &) |
| used by the function make_verbose in order to add options to specify the verbose level | |
| void | _init () |
| used by the set of ctors to initiate some useful variables | |
Private Attributes | |
| eoValueParam< std::string > | _verbose |
| eoValueParam< bool > | _printVerboseLevels |
| eoValueParam< std::string > | _output |
| eo::Levels | _selectedLevel |
| _selectedLevel is the member storing verbose level setted by the user thanks to operator() | |
| eo::Levels | _contextLevel |
| int | _fd |
| _fd in storing the file descriptor at this place we can disable easily the buffer in changing the value at -1. | |
| outbuf | _obuf |
| _obuf std::ostream mandates to use a buffer. | |
| MapLevel | _levels |
| _levels contains all the existing level order by position | |
| std::vector< std::string > | _sortedLevels |
| _levelsOrder is just a list to keep the order of levels | |
| std::map< std::ostream *, int > | _standard_io_streams |
| _standard_io_streams | |
Friends | |
| eoLogger & | operator<< (eoLogger &, const eo::Levels) |
| operator<< used there to set a verbose mode. | |
| eoLogger & | operator<< (eoLogger &, eo::file) |
| operator<< used there to set a filename through the class file. | |
| eoLogger & | operator<< (eoLogger &, eo::setlevel) |
| operator<< used there to set a verbose level through the class setlevel. | |
| eoLogger & | operator<< (eoLogger &, std::ostream &) |
| operator<< used there to be able to use std::cout to say that we wish to redirect back the buffer to a standard output. | |
| void | make_verbose (eoParser &) |
| make_verbose gets level of verbose and sets it in eoLogger | |
eoLogger Class providing a verbose management through EO Use of a global variable eo::log to easily use the logger like std::cout
Definition at line 141 of file eoLogger.h.
| eo::Levels eoLogger::getLevelSelected | ( | ) | const [inline] |
Returns the selected levels, that is the one asked by the user
Use this function if you want to be able to compare selected levels to a given one, like: if( eo::log.getLevelSelected() >= eo::progress ) {...}
Definition at line 166 of file eoLogger.h.
References _selectedLevel.
| eo::Levels eoLogger::getLevelContext | ( | ) | const [inline] |
Returns the current level of the context the one given when you output message with the logger
Definition at line 171 of file eoLogger.h.
operator<< used there to set a verbose mode.
in order to use stream style to define the context verbose level where the following logs will be saved
Definition at line 158 of file eoLogger.cpp.
operator<< used there to set a filename through the class file.
in order to use stream style to define a file to dump instead the standart output
Definition at line 164 of file eoLogger.cpp.
| eoLogger& operator<< | ( | eoLogger & | l, |
| eo::setlevel | v | ||
| ) | [friend] |
operator<< used there to set a verbose level through the class setlevel.
in order to use stream style to define manually the verbose level instead using options
Definition at line 170 of file eoLogger.cpp.
operator<< used there to be able to use std::cout to say that we wish to redirect back the buffer to a standard output.
in order to use stream style to go back to a standart output defined by STL and to get retro-compatibility
Definition at line 176 of file eoLogger.cpp.
int eoLogger::_fd [private] |
_fd in storing the file descriptor at this place we can disable easily the buffer in changing the value at -1.
It is used by operator <<.
Definition at line 250 of file eoLogger.h.
Referenced by ~eoLogger().
outbuf eoLogger::_obuf [private] |
_obuf std::ostream mandates to use a buffer.
_obuf is a outbuf inheriting of std::streambuf.
Definition at line 255 of file eoLogger.h.