From b66c38ce2cb39933db411c7cdf543e358008a5d3 Mon Sep 17 00:00:00 2001 From: LPTK Date: Mon, 10 Jun 2013 18:34:57 +0200 Subject: [PATCH] minor fixes --- eo/src/utils/eoLogger.cpp | 4 +-- eo/src/utils/eoLogger.h | 57 +++------------------------------------ eo/test/t-eoLogger.cpp | 6 ----- 3 files changed, 6 insertions(+), 61 deletions(-) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index 79813137c..cd80ba67e 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -41,8 +41,8 @@ Caner Candan #include "eoLogger.h" /* TODO? -- changer oprateurs -- virer la structure "file" +add a possibility to redirect to several streams +add_redirect/remove_redirect */ void eoLogger::_init() diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index e655848c7..6c2599eb6 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -30,56 +30,7 @@ Caner Candan Global logger for EO. - Here's an example explaning how to use eoLogger: -\code - #include - - int main(int ac, char** av) - { - // We are declaring the usual eoParser class - eoParser parser(ac, av); - - // This call is important to allow -v parameter to change user level. - make_verbose(parser); - - // At this time we are switching to warning message and messages - // which are going to follow it are going to be warnings message too. - // These messages can be displayed only if the user level (sets with - // eo::setlevel function) is set to eo::warnings. - eo::log << eo::warnings; - - // With the following eo::file function we are defining that - // all future logs are going to this new file resource which is - // test.txt - eo::log << eo::file("test.txt") << "In FILE" << std::endl; - - // Now we are changing again the resources destination to cout which - // is the standard output. - eo::log << std::cout << "In COUT" << std::endl; - - // Here are 2 differents examples of how to set the errors user level - // in using either a string or an identifier. - eo::log << eo::setlevel("errors"); - eo::log << eo::setlevel(eo::errors); - - // Now we are writting a message, that will be displayed only if we are above the "quiet" level - eo::log << eo::quiet << "1) Must be in quiet mode to see that" << std::endl; - - // And so on... - eo::log << eo::setlevel(eo::warnings) << eo::warnings << "2) Must be in warnings mode to see that" << std::endl; - - eo::log << eo::setlevel(eo::logging); - - eo::log << eo::errors; - eo::log << "3) Must be in errors mode to see that"; - eo::log << std::endl; - - eo::log << eo::debug << 4 << ')' - << " Must be in debug mode to see that\n"; - - return 0; - } -\endcode + For an example explaning of how to use eoLogger, see paradiseo/eo/test/t-eoLogger.cpp @{ */ @@ -220,7 +171,7 @@ public: friend eoLogger& operator<<(eoLogger&, eo::setlevel); /** - * DEPRECATED: Use instead the redirectTo method + * DEPRECATED: Use instead the redirect method * 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 @@ -230,7 +181,7 @@ public: /** * Redirects the logger to a given output stream. Closing the stream and returning its memory is at the charge of the caller, - * but should not be done while the log is still redirected to it. + * but should not be done while the logger is still redirected to it. */ void redirect(std::ostream&); @@ -249,7 +200,7 @@ private: eoValueParam _output; /** - * _selectedLevel is the member storing verbose level setted by the user thanks to operator() + * _selectedLevel is the member storing verbose level set by the user thanks to operator() */ eo::Levels _selectedLevel; eo::Levels _contextLevel; diff --git a/eo/test/t-eoLogger.cpp b/eo/test/t-eoLogger.cpp index a1ea4b60c..67a06c8e3 100644 --- a/eo/test/t-eoLogger.cpp +++ b/eo/test/t-eoLogger.cpp @@ -29,10 +29,7 @@ int main(int ac, char** av) eo::log << "We are writing on the default output stream" << std::endl; - //eo::log << eo::file("test.txt") << "In FILE" << std::endl; - std::ofstream ofs("logtest.txt"); - //eo::log << ofs << "In FILE" << std::endl; eo::log.redirect(ofs); eo::log << "In FILE" << std::endl; @@ -40,14 +37,11 @@ int main(int ac, char** av) eo::log << "In FILE 2" << std::endl; std::ostringstream oss; - //eo::log << oss << "In STRINGSTREAM"; eo::log.redirect(oss); eo::log << oss << "In STRINGSTREAM"; - //ofs << oss; std::cout << "Content of ostringstream: " << oss.str() << std::endl; - //eo::log << std::cout << "on COUT" << std::endl; eo::log.redirect(std::cout); eo::log << "on COUT" << std::endl;