diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h index 5166e98be7ecd293bff9f358d70db74e190020c0..c387e40dc95dbf1f3f5eb5986fb2853479dd3585 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h @@ -239,6 +239,10 @@ public: void setLoggingOffset(const int value) { g_log.setLevelOffset(value); } ///returns the logging priority offset int getLoggingOffset() const { return g_log.getLevelOffset(); } + /// disable Logging of start and end messages + void setAlgStartupLogging(const bool enabled); + /// get the state of Logging of start and end messages + bool getAlgStartupLogging() const; ///setting the child start progress void setChildStartProgress(const double startProgress)const{m_startChildProgress=startProgress;} @@ -380,6 +384,7 @@ private: bool m_runningAsync; ///< Algorithm is running asynchronously bool m_running; ///< Algorithm is running bool m_rethrow; ///< Algorithm should rethrow exceptions while executing + bool m_isAlgStartupLoggingEnabled; /// Whether to log alg startup and closedown messages from the base class (default = true) mutable double m_startChildProgress; ///< Keeps value for algorithm's progress at start of an Child Algorithm mutable double m_endChildProgress; ///< Keeps value for algorithm's progress at Child Algorithm's finish AlgorithmID m_algorithmID; ///< Algorithm ID for managed algorithms diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h index 182878ba1ebe9359a90cde114d89881314ee6f2b..fadf11ba92eafc604e654f7e07c63b93392ac3bb 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h @@ -131,6 +131,10 @@ namespace Mantid void setLoggingOffset(const int value) { m_loggingOffset=value; } ///returns the logging priority offset int getLoggingOffset() const { return m_loggingOffset; } + /// disable Logging of start and end messages + void setAlgStartupLogging(const bool enabled); + /// get the state of Logging of start and end messages + bool getAlgStartupLogging() const; ///setting the child start progress void setChildStartProgress(const double startProgress)const; @@ -171,6 +175,7 @@ namespace Mantid bool m_isExecuted; ///< Executed flag bool m_isLoggingEnabled;///< is the logging of the underlying algorithm enabled int m_loggingOffset; ///< the logging priority offset + bool m_isAlgStartupLoggingEnabled; /// Whether to log alg startup and closedown messages from the base class (default = true) bool m_rethrow; ///< Whether or not to rethrow exceptions. bool m_isChild; ///< Is this a child algo diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IAlgorithm.h b/Code/Mantid/Framework/API/inc/MantidAPI/IAlgorithm.h index ec14a1fea6817ffed6f909c4103c72d28c298e23..01e34ad0e1ff42dc10c6b4c8363f8d578e63840c 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IAlgorithm.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IAlgorithm.h @@ -156,6 +156,10 @@ public: virtual void setLoggingOffset(const int value) = 0; ///returns the logging priority offset virtual int getLoggingOffset() const = 0; + /// disable Logging of start and end messages + virtual void setAlgStartupLogging(const bool enabled) = 0; + /// get the state of Logging of start and end messages + virtual bool getAlgStartupLogging() const = 0; ///setting the child start progress virtual void setChildStartProgress(const double startProgress)const = 0; /// setting the child end progress diff --git a/Code/Mantid/Framework/API/src/Algorithm.cpp b/Code/Mantid/Framework/API/src/Algorithm.cpp index 591e7aee085a1737bb712f57e7a8baa68f8bc954..fe423171bea9e9198eaaf6fc81646fa2c5e07f32 100644 --- a/Code/Mantid/Framework/API/src/Algorithm.cpp +++ b/Code/Mantid/Framework/API/src/Algorithm.cpp @@ -84,7 +84,8 @@ namespace Mantid m_progressObserver(NULL), m_isInitialized(false), m_isExecuted(false),m_isChildAlgorithm(false), m_recordHistoryForChild(false), m_alwaysStoreInADS(false),m_runningAsync(false), - m_running(false), m_rethrow(false), m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false) + m_running(false), m_rethrow(false), m_isAlgStartupLoggingEnabled(true), + m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false) { } @@ -1034,6 +1035,7 @@ namespace Mantid m_algorithmID = proxy.getAlgorithmID(); setLogging(proxy.isLogging()); setLoggingOffset(proxy.getLoggingOffset()); + setAlgStartupLogging(proxy.getAlgStartupLogging()); setChild(proxy.isChild()); } @@ -1209,7 +1211,10 @@ namespace Mantid { auto & logger = getLogger(); - logger.notice() << name() << " started"; + if (m_isAlgStartupLoggingEnabled) + { + logger.notice() << name() << " started"; + } if (this->isChild()) logger.notice() << " (child)"; logger.notice() << std::endl; @@ -1662,8 +1667,11 @@ namespace Mantid if (!m_isChildAlgorithm || m_alwaysStoreInADS) { - getLogger().notice() << name() << " successful, Duration " - << std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl; + if (m_isAlgStartupLoggingEnabled) + { + getLogger().notice() << name() << " successful, Duration " + << std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl; + } } else @@ -1673,8 +1681,21 @@ namespace Mantid m_running = false; } + /** Enable or disable Logging of start and end messages + @param enabled : true to enable logging, false to disable + */ + void Algorithm::setAlgStartupLogging(const bool enabled) + { + m_isAlgStartupLoggingEnabled = enabled; + } - + /** return the state of logging of start and end messages + @returns : true to logging is enabled + */ + bool Algorithm::getAlgStartupLogging() const + { + return m_isAlgStartupLoggingEnabled; + } } // namespace API //--------------------------------------------------------------------------- diff --git a/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp b/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp index 28253008fce869a0f3bfef76db4165ff11d55377..8291eb87ae8cb2fcdbc22a7a083b571db0dec94c 100644 --- a/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp +++ b/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp @@ -26,7 +26,7 @@ namespace Mantid PropertyManagerOwner(), m_executeAsync(new Poco::ActiveMethod<bool, Poco::Void, AlgorithmProxy>(this,&AlgorithmProxy::executeAsyncImpl)), m_name(alg->name()),m_category(alg->category()), m_categorySeparator(alg->categorySeparator()), m_alias(alg->alias()),m_summary(alg->summary()), m_version(alg->version()), m_alg(alg), - m_isExecuted(),m_isLoggingEnabled(true), m_loggingOffset(0), m_rethrow(false), + m_isExecuted(),m_isLoggingEnabled(true), m_loggingOffset(0), m_isAlgStartupLoggingEnabled(true), m_rethrow(false), m_isChild(false) { if (!alg) @@ -334,6 +334,20 @@ namespace Mantid return res; } + /** Enable or disable Logging of start and end messages + @param enabled : true to enable logging, false to disable + */ + void AlgorithmProxy::setAlgStartupLogging(const bool enabled) + { + m_isAlgStartupLoggingEnabled = enabled; + } + /** return the state of logging of start and end messages + @returns : true to logging is enabled + */ + bool AlgorithmProxy::getAlgStartupLogging() const + { + return m_isAlgStartupLoggingEnabled; + } } // namespace API } // namespace Mantid