diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index 11b0cbee..c9b85060 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -40,7 +40,7 @@ Caner Candan { // We are declaring first an overload of eoParser class using Logger // component. - eoParserLogger parser(ac, av); + eoParserLogger parser(ac, av); // This call is important to allow -v parameter to change user level. make_verbose(parser); @@ -98,7 +98,7 @@ Caner Candan # include "eoObject.h" -namespace eo +namespace eo { /** * Levels contents all the available levels in eoLogger @@ -117,7 +117,7 @@ namespace eo * file * this structure combined with the friend operator<< below is an easy way to select a file as output. */ - struct file + struct file { file(const std::string f); const std::string _f; @@ -127,7 +127,7 @@ namespace eo * setlevel * this structure combined with the friend operator<< below is an easy way to set a verbose level. */ - struct setlevel + struct setlevel { setlevel(const std::string v); setlevel(const Levels lvl); @@ -141,14 +141,14 @@ namespace eo * Class providing a verbose management through EO * Use of a global variable eo::log to easily use the logger like std::cout */ -class eoLogger : public eoObject, - public std::ostream +class eoLogger : public eoObject, + public std::ostream { public: eoLogger(); ~eoLogger(); - virtual std::string className() const; + virtual std::string className() const; //! Print the available levels on the standard output void printLevels() const; @@ -158,107 +158,104 @@ public: * Use this function if you want to be able to compare selected levels to a given one, like: * if( eo::log.getLevelSelected() >= eo::progress ) {...} */ - eo::Levels getLevelSelected() const { return _selectedLevel; } + inline eo::Levels getLevelSelected() const { return _selectedLevel; } /*! Returns the current level of the context * the one given when you output message with the logger */ - eo::Levels getLevelContext() const { return _contextLevel; } + inline eo::Levels getLevelContext() const { return _contextLevel; } protected: - void addLevel(std::string name, eo::Levels level); + void addLevel(std::string name, eo::Levels level); private: /** * outbuf * this class inherits from std::streambuf which is used by eoLogger to write the buffer in an output stream */ - class outbuf : public std::streambuf + class outbuf : public std::streambuf { public: - outbuf(const int& fd, - const eo::Levels& contexlvl, - const eo::Levels& selectedlvl); + outbuf(const int& fd, const eo::Levels& contexlvl, const eo::Levels& selectedlvl); protected: - virtual int overflow(int_type c); + virtual int overflow(int_type c); private: - const int& _fd; - const eo::Levels& _contextLevel; - const eo::Levels& _selectedLevel; + const int& _fd; + const eo::Levels& _contextLevel; + const eo::Levels& _selectedLevel; }; private: /** * MapLevel is the type used by the map member _levels. */ - typedef std::map MapLevel; + typedef std::map MapLevel; public: /** * operator<< used there to set a verbose mode. */ - friend eoLogger& operator<<(eoLogger&, const eo::Levels); + friend eoLogger& operator<<(eoLogger&, const eo::Levels); /** * operator<< used there to set a filename through the class file. */ - friend eoLogger& operator<<(eoLogger&, eo::file); + friend eoLogger& operator<<(eoLogger&, eo::file); /** * operator<< used there to set a verbose level through the class setlevel. */ - friend eoLogger& operator<<(eoLogger&, eo::setlevel); + friend eoLogger& operator<<(eoLogger&, eo::setlevel); /** * operator<< used there to be able to use std::cout to say that we wish to redirect back the buffer to a standard output. */ - friend eoLogger& operator<<(eoLogger&, std::ostream&); + friend eoLogger& operator<<(eoLogger&, std::ostream&); private: /** * _selectedLevel is the member storing verbose level setted by the user thanks to operator() */ - eo::Levels _selectedLevel; - eo::Levels _contextLevel; + eo::Levels _selectedLevel; + eo::Levels _contextLevel; /** * _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 <<. */ - int _fd; + int _fd; /** * _obuf std::ostream mandates to use a buffer. _obuf is a outbuf inheriting of std::streambuf. */ - outbuf _obuf; + outbuf _obuf; /** * _levels contains all the existing level order by position */ - MapLevel _levels; + MapLevel _levels; /** * _levelsOrder is just a list to keep the order of levels */ - std::vector _sortedLevels; + std::vector _sortedLevels; /** * _standard_io_streams */ - std::map< std::ostream*, int > _standard_io_streams; + std::map< std::ostream*, int > _standard_io_streams; }; /** @example t-eoLogger.cpp */ -namespace eo +namespace eo { /** * log is an external global variable defined to easily use a same way than std::cout to write a log. */ - extern eoLogger log; + extern eoLogger log; } - /** @} */ #endif // !eoLogger_h