feat: add a way to print a message at each stop criterion call
This commit is contained in:
parent
98501e0dd4
commit
193ea83eb3
3 changed files with 60 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
59
eo/src/utils/eoLogMessage.h
Normal file
59
eo/src/utils/eoLogMessage.h
Normal file
|
|
@ -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 <johann.dreo@thalesgroup.com>
|
||||
*/
|
||||
|
||||
#ifndef _eoLogMessage_h
|
||||
#define _eoLogMessage_h
|
||||
|
||||
#include <string>
|
||||
#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
|
||||
|
|
@ -168,5 +168,4 @@ private :
|
|||
const std::string extension;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue