diff --git a/eo/src/utils/checkpointing b/eo/src/utils/checkpointing index 79fdab123..ad190602a 100644 --- a/eo/src/utils/checkpointing +++ b/eo/src/utils/checkpointing @@ -27,6 +27,7 @@ #include "eoParser.h" #include "eoState.h" #include "eoUpdater.h" +#include "eoLogMessage.h" #include "eoMonitor.h" #include "eoFileMonitor.h" #include "eoTimedMonitor.h" diff --git a/eo/src/utils/eoLogMessage.h b/eo/src/utils/eoLogMessage.h new file mode 100644 index 000000000..4a9a02381 --- /dev/null +++ b/eo/src/utils/eoLogMessage.h @@ -0,0 +1,59 @@ +/* +(c) Thales group, 2020 + + This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free + Software Foundation; version 2 of the license. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this library; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: + Johann Dréo +*/ + +#ifndef _eoLogMessage_h +#define _eoLogMessage_h + +#include +#include "eoUpdater.h" +#include "eoLogger.h" + +/** + An updater that print its message when called (usually within an eoCheckPoint) + + @ingroup Utilities +*/ +class eoLogMessage : public eoUpdater +{ +public : + eoLogMessage( + std::string msg, + eoLogger& log = eo::log, + eo::Levels level = eo::progress + ) : + _msg(msg), + _log(log), + _level(level) + { } + + virtual void operator()() + { + _log << _level << _msg << std::endl; + } + +protected: + std::string _msg; + eoLogger& _log; + eo::Levels _level; + +}; + +#endif diff --git a/eo/src/utils/eoUpdater.h b/eo/src/utils/eoUpdater.h index 0ae3b9c25..6626fabec 100644 --- a/eo/src/utils/eoUpdater.h +++ b/eo/src/utils/eoUpdater.h @@ -168,5 +168,4 @@ private : const std::string extension; }; - #endif