diff --git a/Code/Mantid/Framework/API/CMakeLists.txt b/Code/Mantid/Framework/API/CMakeLists.txt index 8835e9543d7ba26cd2c044b2a719e50342c9500a..389917ad700286b1ab5b060ab75d9fc3a0ed818c 100644 --- a/Code/Mantid/Framework/API/CMakeLists.txt +++ b/Code/Mantid/Framework/API/CMakeLists.txt @@ -62,7 +62,6 @@ set ( SRC_FILES src/ISpectrum.cpp src/ISplittersWorkspace.cpp src/ITableWorkspace.cpp - src/ITransformScale.cpp src/IkedaCarpenterModerator.cpp src/ImmutableCompositeFunction.cpp src/ImplicitFunctionParameterParserFactory.cpp diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h index 2d073e8c5acc9bea9bd0db365b77a3afa582171f..5ee253389dac1f9b978ea7f28b5fdd6666bbd908 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h @@ -224,18 +224,17 @@ public: /// Returns the cancellation state bool getCancel() const { return m_cancel; } + /// Returns a reference to the logger. + Kernel::Logger & getLogger() const { return g_log; } ///Logging can be disabled by passing a value of false - void setLogging(const bool value){g_log.setEnabled(value);} + void setLogging(const bool value) { g_log.setEnabled(value);} ///returns the status of logging, True = enabled - bool isLogging() const {return g_log.getEnabled();} + bool isLogging() const { return g_log.getEnabled();} ///sets the logging priority offset - void setLoggingOffset(const int value) {g_log.setLevelOffset(value);} + void setLoggingOffset(const int value) { g_log.setLevelOffset(value); } ///returns the logging priority offset - int getLoggingOffset() const {return g_log.getLevelOffset();} - - /// Returns a reference to the logger. - Kernel::Logger& getLogger() const { return g_log; } + int getLoggingOffset() const { return g_log.getLevelOffset(); } /// function returns an optional message that will be displayed in the default GUI, at the top. @@ -318,8 +317,6 @@ protected: bool m_cancel; /// Set if an exception is thrown, and not caught, within a parallel region bool m_parallelException; - /// Reference to the logger class - Kernel::Logger& g_log; friend class WorkspaceHistory; // Allow workspace history loading to adjust g_execCount static size_t g_execCount; ///< Counter to keep track of algorithm execution order @@ -338,6 +335,10 @@ protected: /// All the WorkspaceProperties that are Input or InOut. Set in execute() std::vector<IWorkspaceProperty *> m_inputWorkspaceProps; + /// Logger for this algorithm + Kernel::Logger m_log; + Kernel::Logger &g_log; + private: /// Private Copy constructor: NO COPY ALLOWED Algorithm(const Algorithm&); @@ -355,7 +356,6 @@ private: bool executeAsyncImpl(const Poco::Void & i); // --------------------- Private Members ----------------------------------- - /// Poco::ActiveMethod used to implement asynchronous execution. Poco::ActiveMethod<bool, Poco::Void, Algorithm, Poco::ActiveStarter<Algorithm>> *m_executeAsync; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h index 0c71e9cfb22a2556bdf91a1ee5bce3d7039b65a9..e6c392769e6edcd25fe8ee14a210addfef82b2e4 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmFactory.h @@ -10,7 +10,6 @@ #include "MantidAPI/DllConfig.h" #include "MantidKernel/DynamicFactory.h" #include "MantidKernel/SingletonHolder.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -158,8 +157,6 @@ public: std::string createName(const std::string&, const int&)const; /// fills a set with the hidden categories void fillHiddenCategories(std::set<std::string> *categorySet) const; - ///static reference to the logger class - Kernel::Logger& g_log; /// A typedef for the map of algorithm versions typedef std::map<std::string, int> VersionMap; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmManager.h index 0770c385c9845d2ebc4630e5face7d3588be7d14..68e8592da1dbf1ad360567fb14b41f8000af554e 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmManager.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmManager.h @@ -8,7 +8,6 @@ #include <string> #include <Poco/NotificationCenter.h> #include "MantidAPI/DllConfig.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/SingletonHolder.h" #include "MantidAPI/Algorithm.h" @@ -91,8 +90,6 @@ private: /// Unimplemented assignment operator AlgorithmManagerImpl& operator =(const AlgorithmManagerImpl&); - /// Reference to the logger class - Kernel::Logger& g_log; /// The maximum size of the algorithm store int m_max_no_algs; /// The list of managed algorithms diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h index d4fbc1c89cb256b41f2b38d5e3fa46d153b3422e..032ce3f6c3b84b79b13a8b3dc95d58e25caaeae8 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h @@ -185,9 +185,6 @@ namespace Mantid /// Temporary holder of external observers wishing to subscribe mutable std::vector<const Poco::AbstractObserver*> m_externalObservers; - - /// Static refenence to the logger class - static Kernel::Logger& g_log; }; } // namespace API diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/CatalogFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/CatalogFactory.h index 43876ecedea067c0be5a5078c1dd73070ac6e2f0..e0fa8a3ddc92ad6c410f977e12f1280d842d2ae3 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/CatalogFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/CatalogFactory.h @@ -25,14 +25,6 @@ namespace Mantid { - //---------------------------------------------------------------------- - // Forward declaration - //---------------------------------------------------------------------- - namespace Kernel - { - class Logger; - } - namespace API { //---------------------------------------------------------------------- @@ -79,8 +71,6 @@ namespace Mantid virtual ~CatalogFactoryImpl(); /// Stores pointers to already created Catalog instances, with their name as the key mutable std::map< std::string, boost::shared_ptr<ICatalog> > m_createdCatalogs; - /// Reference to the logger class - Kernel::Logger& m_log; }; ///Forward declaration of a specialisation of SingletonHolder for CatalogFactoryImpl (needed for dllexport/dllimport) . diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Column.h b/Code/Mantid/Framework/API/inc/MantidAPI/Column.h index 7b3fec201cf58afa35c9a55f03df5898809b7d8d..a5d2f4e206aa4cdf151271e62c4fe69a179d4a26 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Column.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Column.h @@ -5,7 +5,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/DllConfig.h" -#include "MantidKernel/Logger.h" #include <boost/shared_ptr.hpp> #include <string> @@ -16,14 +15,6 @@ namespace Mantid { -//---------------------------------------------------------------------- -// Forward declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} - namespace API { /** \class Column @@ -188,8 +179,6 @@ protected: friend class ColumnFactoryImpl; friend class ITableWorkspace; template<class T> friend class ColumnVector; - /// Logger - static Kernel::Logger& g_log; }; /** @class Boolean diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ColumnFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/ColumnFactory.h index ef899f749027bd322e321824d3fbc6da939be289..ede2a739c2c2adb18f79a2aff5500b9f86c00734 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ColumnFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ColumnFactory.h @@ -11,22 +11,13 @@ namespace Mantid { - -//---------------------------------------------------------------------- -// Forward declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} namespace API { + //---------------------------------------------------------------------- + // Forward declarations + //---------------------------------------------------------------------- class Column; -} - -namespace API -{ /** @class ColumnFactoryImpl @@ -74,8 +65,6 @@ namespace API ColumnFactoryImpl& operator = (const ColumnFactoryImpl&); ///Private Destructor virtual ~ColumnFactoryImpl(); - ///static reference to the logger class - Kernel::Logger& g_log; }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ConstraintFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/ConstraintFactory.h index 3c853199974b350bca5fa80b31be4eb8ada75c4b..afa75eb41e50b74a44ee1cacc501bde520020603 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ConstraintFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ConstraintFactory.h @@ -11,20 +11,12 @@ namespace Mantid { - -//---------------------------------------------------------------------- -// Forward declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} namespace API { //---------------------------------------------------------------------- -// More forward declarations +// Forward declarations //---------------------------------------------------------------------- class IConstraint; class IFunction; @@ -79,10 +71,6 @@ namespace API ConstraintFactoryImpl& operator = (const ConstraintFactoryImpl&); ///Private Destructor virtual ~ConstraintFactoryImpl(); - - ///static reference to the logger class - Kernel::Logger& g_log; - }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/CostFunctionFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/CostFunctionFactory.h index d129ceda1c81ec09e8c4d7ba6a81ce95b6d8e53b..a8d62acd6f7607227830d689c4c7516d1f9efe36 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/CostFunctionFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/CostFunctionFactory.h @@ -63,9 +63,6 @@ namespace API friend struct Mantid::Kernel::CreateUsingNew<CostFunctionFactoryImpl>; /// Private Constructor for singleton class CostFunctionFactoryImpl(); - - ///static reference to the logger class - Kernel::Logger& g_log; }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h b/Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h index b98ec1742dd828b38a116b4c53b30358f80fc1f0..41e5e65a0a5f2b0c81406bf79692ea3052274ffa 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h @@ -137,9 +137,6 @@ namespace API protected: - /// Static reference to the logger class - static Kernel::Logger& g_log; - /// Description of the source object boost::shared_ptr<ModeratorModel> m_moderatorModel; /// Description of the choppers for this experiment. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h b/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h index e8fe86c96224a32f3af0ef7d33557dbf194f3bf8..8f4b3b78ebcd512661a598a00fbba1ae4ab09173 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FileFinder.h @@ -4,8 +4,6 @@ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidKernel/Logger.h" -#include "MantidKernel/InstrumentInfo.h" #include "MantidKernel/SingletonHolder.h" #include "MantidAPI/DllConfig.h" #include "MantidAPI/IArchiveSearch.h" @@ -15,6 +13,13 @@ namespace Mantid { + //--------------------------------------------------------------------------- + // Forward declarations + //--------------------------------------------------------------------------- + namespace Kernel + { + class InstrumentInfo; + } namespace API { @@ -80,9 +85,6 @@ namespace Mantid std::string toUpper(const std::string &src) const; /// glob option - set to case sensitive or insensitive int m_globOption; - - /// reference to the logger class - Mantid::Kernel::Logger& g_log; }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FileLoaderRegistry.h b/Code/Mantid/Framework/API/inc/MantidAPI/FileLoaderRegistry.h index 9707f11d361eb01a71cd8cd068b30d59518aa156..3c357f37bc65eceed2ef2485a4c6199f258901a0 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FileLoaderRegistry.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FileLoaderRegistry.h @@ -134,7 +134,7 @@ namespace Mantid size_t m_totalSize; /// Reference to a logger - Kernel::Logger & m_log; + mutable Kernel::Logger m_log; }; ///Forward declaration of a specialisation of SingletonHolder for FileLoaderRegistryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FrameworkManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/FrameworkManager.h index 3fb03f3ea06ef6aa45b93c38f8c7efc4f170b5de..8224575367ab996b3e83c92a4047aadce65fe930 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FrameworkManager.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FrameworkManager.h @@ -18,11 +18,6 @@ namespace Mantid { - namespace Kernel - { - class Logger; - } - namespace API { //---------------------------------------------------------------------- @@ -117,9 +112,6 @@ namespace Mantid /// Silence NeXus output void disableNexusOutput(); - /// Reference to the logger class - Kernel::Logger& g_log; - #ifdef MPI_BUILD /** Member variable that initialises the MPI environment on construction (in the * FrameworkManager constructor) and finalises it on destruction. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FuncMinimizerFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/FuncMinimizerFactory.h index c490bb313bc1c5fc61661ec29d0867092484cc03..9b6203020fc698474787acf6f7207e9ecf9430ee 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FuncMinimizerFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FuncMinimizerFactory.h @@ -59,9 +59,6 @@ namespace API friend struct Mantid::Kernel::CreateUsingNew<FuncMinimizerFactoryImpl>; /// Private Constructor for singleton class FuncMinimizerFactoryImpl(); - - ///static reference to the logger class - Kernel::Logger& g_log; }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionFactory.h index b9fed8c63c82d4b379622c64ddf7bb52ba6df66d..8286452725aef4cb903ecba1de08d2020a9be924 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionFactory.h @@ -15,14 +15,6 @@ namespace Mantid { - -//---------------------------------------------------------------------- -// Forward declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} namespace API { @@ -124,9 +116,6 @@ namespace API /// Add a tie to the created function void addTie(boost::shared_ptr<IFunction> fun,const Expression& expr)const; - /// Reference to the logger class - Kernel::Logger& g_log; - mutable std::map<std::string,std::vector<std::string>> m_cachedFunctionNames; mutable Kernel::Mutex m_mutex; }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionProperty.h b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionProperty.h index eba0b6c6c551c8fde1d07b62aa0d7d3912395aaa..b4afdbd516ea0a56986f4a3ab91a53b9d58e758c 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/FunctionProperty.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/FunctionProperty.h @@ -7,7 +7,6 @@ #include "MantidAPI/DllConfig.h" #include "MantidAPI/IFunction.h" #include "MantidKernel/PropertyWithValue.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/Exception.h" #include <boost/shared_ptr.hpp> @@ -90,9 +89,6 @@ namespace Mantid /// The function definition string (as used by the FunctionFactory) std::string m_definition; - - /// for access to logging streams - static Kernel::Logger& g_log; }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/GridDomain.h b/Code/Mantid/Framework/API/inc/MantidAPI/GridDomain.h index a08288b2f78fd9b8a1544489f9e1203379a39816..a353d13880e2bb44013dc32051108568216c822e 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/GridDomain.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/GridDomain.h @@ -9,7 +9,6 @@ #include "MantidAPI/DllConfig.h" #include "MantidAPI/FunctionDomain.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -56,9 +55,6 @@ public: /// re-scale all grids void reScale( const std::string &scaling); -protected: - static Kernel::Logger& g_log; - private: /// composition of grids std::vector< boost::shared_ptr<GridDomain> > m_grids; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IFunction.h b/Code/Mantid/Framework/API/inc/MantidAPI/IFunction.h index 6027de4d263665b48442e970fbc10efcaecd0ffa..a18a13d200a014c2a72a4b12d7d919693cbb22a6 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IFunction.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IFunction.h @@ -10,7 +10,6 @@ #include "MantidAPI/FunctionValues.h" #include "MantidAPI/Jacobian.h" #include "MantidKernel/Matrix.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/Exception.h" #include "MantidKernel/Unit.h" @@ -483,9 +482,6 @@ protected: /// Pointer to the progress handler Kernel::ProgressBase *m_progReporter; - /// Static reference to the logger class - static Kernel::Logger& g_log; - private: /// The declared attributes std::map<std::string, API::IFunction::Attribute> m_attrs; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IFunction1D.h b/Code/Mantid/Framework/API/inc/MantidAPI/IFunction1D.h index d07c5b814ac5feee876a498dc25f3e274d258471..b8efedd66d4462e2318e7900d8ca4226f0bda77c 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IFunction1D.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IFunction1D.h @@ -77,9 +77,6 @@ public: protected: - /// Static reference to the logger class - static Kernel::Logger& g_log; - /// Making a friend friend class CurveFitting::Fit; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMD.h b/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMD.h index 6fd400a2616f42c54eb602ec93444df3f663bb6d..233788ffa19f1d6c792dd9ad26f79c47159e184d 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMD.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMD.h @@ -92,10 +92,6 @@ protected: /// dimensions used in this function in the expected order std::vector< boost::shared_ptr<const Mantid::Geometry::IMDDimension> > m_dimensions; - - /// Static reference to the logger class - static Kernel::Logger& g_log; - private: /// Use all the dimensions in the workspace virtual void useAllDimensions(boost::shared_ptr<const IMDWorkspace> workspace); diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMW.h b/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMW.h index 786348415c281c09c02a92ade30772dee39ce848..d92b3bf1d27d26315142c50006e4074da06a5c1a 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMW.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IFunctionMW.h @@ -56,10 +56,6 @@ protected: boost::weak_ptr<const API::MatrixWorkspace> m_workspace; /// An index to a spectrum size_t m_workspaceIndex; - - /// Static reference to the logger class - static Kernel::Logger& g_log; - }; } // namespace API diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h index b2c0faef5a0789f81b7f72e60286b274acdb7903..8d91ba48a77cc25ac6251ff5850ce020fc38f7b4 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ITableWorkspace.h @@ -20,10 +20,6 @@ namespace Mantid //---------------------------------------------------------------------- // Forward declarations //---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} namespace API { @@ -204,7 +200,6 @@ public: { std::string str = std::string("getRef: Type mismatch. ") + typeid(T).name() + " != " + c->get_type_info().name() + '\n'; - g_log.error(str); throw std::runtime_error(str); } return *(static_cast<T*>(c->void_pointer(index))); @@ -225,7 +220,6 @@ public: { std::ostringstream ostr; ostr << "cell: Type mismatch:\n"<<typeid(T).name()<<" != \n"<<c->get_type_info().name()<<'\n'; - g_log.error(ostr.str()); throw std::runtime_error(ostr.str()); } if (row >= this->rowCount()) @@ -317,10 +311,6 @@ protected: { c->remove(index); } -private: - /// Logger - static Kernel::Logger& g_log; - }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ITransformScale.h b/Code/Mantid/Framework/API/inc/MantidAPI/ITransformScale.h index 9f3174eac28d641da1a5a61e7c48a07690e42939..f07637c558b091cbc868327895e7dee83f198ab0 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ITransformScale.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ITransformScale.h @@ -8,7 +8,6 @@ #include <vector> #include "MantidAPI/DllConfig.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -49,9 +48,6 @@ public: virtual const std::string name() const { return "ITransformScale"; } /// The scaling transformation. Define in derived classes virtual void transform( std::vector<double> &gd ) = 0; - -protected: - static Kernel::Logger& g_log; }; // class ITransformScale /// typedef for a shared pointer diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/LiveListenerFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/LiveListenerFactory.h index db8bbbda691ff620692bb989c80e9d109c176fde..a5c453a3f5753adab79bbccd51201fe5baf4ba86 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/LiveListenerFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/LiveListenerFactory.h @@ -69,9 +69,6 @@ namespace Mantid using Kernel::DynamicFactory<ILiveListener>::create; /// Override the DynamicFactory::createUnwrapped() method. We don't want it used here. ILiveListener* createUnwrapped(const std::string& className) const; - - /// Reference to the logger class - Kernel::Logger& m_log; }; ///Forward declaration of a specialisation of SingletonHolder (needed for dllexport/dllimport). diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h index b3bf17d51bad24920aeb5e40fc095e00c77d1514..f717d6334a6cf7c28bf805a8d7df07c770df4b83 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/LogManager.h @@ -152,8 +152,6 @@ namespace Mantid virtual void loadNexus(::NeXus::File * file, const std::string & group,bool keepOpen=false); protected: - /// Static reference to the logger class - static Kernel::Logger &g_log; /// A pointer to a property manager Kernel::PropertyManager m_manager; /// Name of the log entry containing the proton charge when retrieved using getProtonCharge diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h b/Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h index 7183da5e5f71849b3fe32f75268dbc937330350e..7ed4714fb96aa4f87afa264a8c82b756e52e0dde 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h @@ -340,9 +340,6 @@ namespace Mantid /// Shared pointer to NearestNeighbours object mutable boost::shared_ptr<Mantid::Geometry::INearestNeighbours> m_nearestNeighbours; - /// Static reference to the logger class - static Kernel::Logger& g_log; - /// Getter for the dimension id based on the axis. std::string getDimensionIdFromAxis(const int& axisIndex) const; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/MemoryManager.h b/Code/Mantid/Framework/API/inc/MantidAPI/MemoryManager.h index baf596fd8c90258c630f9f08d4f5f2dec000c0b8..5e29cbf3c06587b1fcc636813932dcb354ebc832 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/MemoryManager.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/MemoryManager.h @@ -5,7 +5,6 @@ // Includes //---------------------------------------------------------------------- #include "MantidAPI/DllConfig.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/MultiThreaded.h" #include "MantidKernel/SingletonHolder.h" @@ -75,9 +74,6 @@ namespace Mantid /// Standard Assignment operator MemoryManagerImpl& operator = (const MemoryManagerImpl&); - /// Static reference to the logger class - Kernel::Logger& g_log; - /** Amount of memory (in bytes) that has been cleared but perhaps not released. * releaseFreeMemoryIfAccumulated() uses this value */ diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/MultipleFileProperty.h b/Code/Mantid/Framework/API/inc/MantidAPI/MultipleFileProperty.h index 9ecd69ccb714cf8e32d1a78695ef518bbe0f8d21..f34f61754b5dc76e7fdb5b683d6350393e2dc757 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/MultipleFileProperty.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/MultipleFileProperty.h @@ -1,9 +1,7 @@ #ifndef MANTID_API_MULTIPLEFILEPROPERTY_H_ #define MANTID_API_MULTIPLEFILEPROPERTY_H_ -#include "MantidKernel/Logger.h" #include "MantidKernel/PropertyWithValue.h" -#include "MantidKernel/System.h" #include "MantidKernel/MultiFileNameParser.h" #include <vector> #include <set> @@ -138,8 +136,6 @@ namespace API Kernel::MultiFileNameParsing::Parser m_parser; ///The default file extension associated with the type of file this property will handle std::string m_defaultExt; - /// Reference to the logger class - Kernel::Logger& g_log; }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/Run.h b/Code/Mantid/Framework/API/inc/MantidAPI/Run.h index 17ee476227f3baef2344de29d1510c0caab48c01..a08bd315f1539d600ea34f5ff9ddb0ea7472f73b 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/Run.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/Run.h @@ -97,8 +97,6 @@ namespace Mantid /// Calculate the gonoimeter matrix void calculateGoniometerMatrix(); - /// Static reference to the logger class - static Kernel::Logger &g_log; /// Goniometer for this run Mantid::Geometry::Goniometer m_goniometer; /// A set of histograms that can be stored here for future reference diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepositoryFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepositoryFactory.h index 32b89d2cb259c394643a68ec157fc42bab19ecd9..b7b5799711d9e5e08bc9664cee371f859398bef9 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepositoryFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/ScriptRepositoryFactory.h @@ -14,14 +14,6 @@ namespace Mantid { -//---------------------------------------------------------------------- -// Forward declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} - namespace API { @@ -75,10 +67,6 @@ namespace API ScriptRepositoryFactoryImpl& operator = (const ScriptRepositoryFactoryImpl&); ///Private Destructor virtual ~ScriptRepositoryFactoryImpl(); - - ///static reference to the logger class - Kernel::Logger& g_log; - }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/TableRow.h b/Code/Mantid/Framework/API/inc/MantidAPI/TableRow.h index 8212e01c0e56d3c83aa17a67187651cf657ddbb1..daa12f59e7dc7a4e91e3aa6afcb63295628b5386 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/TableRow.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/TableRow.h @@ -11,17 +11,11 @@ namespace Mantid { +namespace API +{ //---------------------------------------------------------------------- // Forward declarations //---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} - -namespace API -{ - class TableRowHelper; /** \class TableRow @@ -80,14 +74,12 @@ public: { if (m_col >= m_columns.size()) { - g_log.error("Column index out of range."); throw std::range_error("Column index out of range."); } Column_sptr c = m_columns[m_col]; if (!c->isType<T>()) { std::string str = "Type mismatch. "; - g_log.error(str); throw std::runtime_error(str); } c->cell<T>(m_row) = t; @@ -111,7 +103,6 @@ public: { if (m_col >= m_columns.size()) { - g_log.error("Column index out of range."); throw std::range_error("Column index out of range."); } Column_sptr c = m_columns[m_col]; @@ -136,7 +127,6 @@ public: { if (col >= m_columns.size()) { - g_log.error("Column index out of range."); throw std::range_error("Column index out of range."); } m_col = col; @@ -176,8 +166,6 @@ private: mutable size_t m_col; ///< Current column number (for streaming operations) size_t m_nrows; ///< Number of rows in the TableWorkspace std::string m_sep; ///< Separator character(s) between elements in a text output - /// Logger - static Kernel::Logger& g_log; }; MANTID_API_DLL std::ostream& operator<<(std::ostream& s,const TableRow& row); diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/TransformScaleFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/TransformScaleFactory.h index 411e6cf8d61376590a42e4a3a89609e84e4726be..a464bb2ba170bb081248f3051e516a109766b55c 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/TransformScaleFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/TransformScaleFactory.h @@ -65,8 +65,6 @@ namespace Mantid TransformScaleFactoryImpl(const TransformScaleFactoryImpl&); /// Private assignment operator - NO ASSIGNMENT ALLOWED TransformScaleFactoryImpl& operator = (const TransformScaleFactoryImpl&); - ///reference to the logger class - Kernel::Logger& g_log; // Do not use default methods }; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceFactory.h b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceFactory.h index 8420bd12fc0c8b2f3feb1625b4553e39525f8a15..2e665bd9b6a777c5993d61d34ab1dd7daa2013d7 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceFactory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceFactory.h @@ -92,9 +92,6 @@ private: // Unhide the inherited create method but make it private using Kernel::DynamicFactory<Workspace>::create; - - /// Static reference to the logger class - Kernel::Logger& g_log; }; ///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it. diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceGroup.h b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceGroup.h index c9cb7293c02d38e224419b82eb80046b8ae80edd..289f288ff4af72d65ad27d245f6f66e901c37023 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceGroup.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceGroup.h @@ -13,14 +13,6 @@ namespace Mantid { -//---------------------------------------------------------------------- -// Forward Declarations -//---------------------------------------------------------------------- -namespace Kernel -{ - class Logger; -} - namespace API { //---------------------------------------------------------------------- @@ -137,10 +129,6 @@ private: bool m_observingADS; /// Recursive mutex to avoid simultaneous access mutable Poco::Mutex m_mutex; - /// Static reference to the logger - static Kernel::Logger& g_log; - /// Maximum allowed depth for nested groups. - static size_t g_maximum_depth; friend class AnalysisDataServiceImpl; friend class Algorithm; diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceHistory.h b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceHistory.h index aa91fc6cdee5a6e3be45f4f1ed18bbcdef7259ba..2646f7156975d3b94a7c2dda5b3158b664bfeb8d 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceHistory.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceHistory.h @@ -6,11 +6,17 @@ //---------------------------------------------------------------------- #include "MantidAPI/AlgorithmHistory.h" #include "MantidKernel/EnvironmentHistory.h" -#include <nexus/NeXusFile.hpp> #include <boost/shared_ptr.hpp> #include <ctime> -#include <list> -#include "MantidKernel/Logger.h" +#include <set> + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +namespace NeXus +{ + class File; +} namespace Mantid { @@ -93,9 +99,6 @@ private: /// The algorithms which have been called on the workspace AlgorithmHistories m_algorithms; - /// Reference to the logger class - Kernel::Logger& g_log; - }; MANTID_API_DLL std::ostream& operator<<(std::ostream&, const WorkspaceHistory&); diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceProperty.h b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceProperty.h index 9f8e259e6000da388ce8c1d883646ea3bd4c4a72..20b4fb49570c43512b7b271f3eace887e34fdcc8 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceProperty.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/WorkspaceProperty.h @@ -511,11 +511,11 @@ namespace Mantid LockMode::Type m_locking; /// for access to logging streams - static Kernel::Logger& g_log; + static Kernel::Logger g_log; }; template <typename TYPE> - Kernel::Logger& WorkspaceProperty<TYPE>::g_log = Kernel::Logger::get("WorkspaceProperty"); + Kernel::Logger WorkspaceProperty<TYPE>::g_log("WorkspaceProperty"); } // namespace API } // namespace Mantid diff --git a/Code/Mantid/Framework/API/src/Algorithm.cpp b/Code/Mantid/Framework/API/src/Algorithm.cpp index 800f78aff5e602104338e6a483ed6ba88753029d..2e33734c48b0ad06a4a0863b7aa397b0c5134df2 100644 --- a/Code/Mantid/Framework/API/src/Algorithm.cpp +++ b/Code/Mantid/Framework/API/src/Algorithm.cpp @@ -77,7 +77,7 @@ namespace Mantid /// Constructor Algorithm::Algorithm() : PropertyManagerOwner(), - m_cancel(false),m_parallelException(false),g_log(Kernel::Logger::get("Algorithm")), + m_cancel(false),m_parallelException(false), m_log("Algorithm"), g_log(m_log), m_executeAsync(NULL), m_notificationCenter(NULL), m_progressObserver(NULL), @@ -95,7 +95,6 @@ namespace Mantid delete m_executeAsync; delete m_progressObserver; - g_log.release(); // Free up any memory available. Mantid::API::MemoryManager::Instance().releaseFreeMemory(); } @@ -302,7 +301,6 @@ namespace Mantid } catch(std::runtime_error& ex) { - g_log.error() << "Error initializing " << this->name() << " algorithm: " << ex.what() << std::endl; throw; } @@ -319,7 +317,7 @@ namespace Mantid { // Gaudi: A call to the auditor service is here // (1) perform the printout - g_log.fatal("UNKNOWN Exception is caught in initialize()"); + getLogger().fatal("UNKNOWN Exception is caught in initialize()"); throw; } @@ -397,6 +395,7 @@ namespace Mantid throw std::logic_error("Algorithm::lockWorkspaces(): The workspaces have already been locked!"); // First, Write-lock the output workspaces + auto & debugLog = g_log.debug(); for (size_t i=0; i<m_outputWorkspaceProps.size(); i++) { Workspace_sptr ws = m_outputWorkspaceProps[i]->getWorkspace(); @@ -408,7 +407,7 @@ namespace Mantid && std::find(m_writeLockedWorkspaces.begin(), m_writeLockedWorkspaces.end(), ws) == m_writeLockedWorkspaces.end()) { // Write-lock it if not already - g_log.debug() << "Write-locking " << ws->getName() << std::endl; + debugLog << "Write-locking " << ws->getName() << std::endl; ws->getLock()->writeLock(); m_writeLockedWorkspaces.push_back(ws); } @@ -427,7 +426,7 @@ namespace Mantid && std::find(m_writeLockedWorkspaces.begin(), m_writeLockedWorkspaces.end(), ws) == m_writeLockedWorkspaces.end()) { // Read-lock it if not already write-locked - g_log.debug() << "Read-locking " << ws->getName() << std::endl; + debugLog << "Read-locking " << ws->getName() << std::endl; ws->getLock()->readLock(); m_readLockedWorkspaces.push_back(ws); } @@ -444,13 +443,13 @@ namespace Mantid // Do not lock workspace for child algos if (this->isChild()) return; - + auto & debugLog = g_log.debug(); for (size_t i=0; i<m_writeLockedWorkspaces.size(); i++) { Workspace_sptr ws = m_writeLockedWorkspaces[i]; if (ws) { - g_log.debug() << "Unlocking " << ws->getName() << std::endl; + debugLog << "Unlocking " << ws->getName() << std::endl; ws->getLock()->unlock(); } } @@ -459,7 +458,7 @@ namespace Mantid Workspace_sptr ws = m_readLockedWorkspaces[i]; if (ws) { - g_log.debug() << "Unlocking " << ws->getName() << std::endl; + debugLog << "Unlocking " << ws->getName() << std::endl; ws->getLock()->unlock(); } } @@ -485,7 +484,7 @@ namespace Mantid { DeprecatedAlgorithm * depo = dynamic_cast<DeprecatedAlgorithm *>(this); if (depo != NULL) - g_log.error(depo->deprecationMsg(this)); + getLogger().error(depo->deprecationMsg(this)); } // Start by freeing up any memory available. Mantid::API::MemoryManager::Instance().releaseFreeMemory(); @@ -496,7 +495,6 @@ namespace Mantid // Return a failure if the algorithm hasn't been initialized if ( !isInitialized() ) { - g_log.error("Algorithm is not initialized:" + this->name()); throw std::runtime_error("Algorithm is not initialised:" + this->name()); } @@ -534,15 +532,17 @@ namespace Mantid { size_t numErrors = errors.size(); // Log each issue + auto & errorLog = getLogger().error(); + auto & warnLog = getLogger().warning(); for (auto it = errors.begin(); it != errors.end(); it++) { if (this->existsProperty(it->first)) - g_log.error() << "Invalid value for " << it->first << ": " << it->second << "\n"; + errorLog << "Invalid value for " << it->first << ": " << it->second << "\n"; else { numErrors -= 1; // don't count it as an error - g_log.warning() << "validateInputs() references non-existant property \"" - << it->first << "\"\n"; + warnLog << "validateInputs() references non-existant property \"" + << it->first << "\"\n"; } } // Throw because something was invalid @@ -568,8 +568,8 @@ namespace Mantid } catch(std::exception& ex) { - g_log.error()<< "Error in execution of algorithm "<< this->name()<<std::endl; - g_log.error()<<ex.what()<<std::endl; + getLogger().error() << "Error in execution of algorithm "<< this->name() << std::endl + << ex.what()<<std::endl; notificationCenter().postNotification(new ErrorNotification(this,ex.what())); m_running = false; if (m_isChildAlgorithm || m_runningAsync || m_rethrow) @@ -626,11 +626,11 @@ namespace Mantid setExecuted(true); if (!m_isChildAlgorithm || m_alwaysStoreInADS) { - g_log.notice() << name() << " successful, Duration " + getLogger().notice() << name() << " successful, Duration " << std::fixed << std::setprecision(2) << duration << " seconds" << std::endl; } else - g_log.debug() << name() << " finished with isChild = " << isChild() << std::endl; + getLogger().debug() << name() << " finished with isChild = " << isChild() << std::endl; m_running = false; } catch(std::runtime_error& ex) @@ -639,8 +639,8 @@ namespace Mantid if (m_isChildAlgorithm || m_runningAsync || m_rethrow) throw; else { - g_log.error()<< "Error in execution of algorithm "<< this->name()<<std::endl; - g_log.error()<< ex.what()<<std::endl; + getLogger().error() << "Error in execution of algorithm "<< this->name()<<std::endl + << ex.what()<<std::endl; } notificationCenter().postNotification(new ErrorNotification(this,ex.what())); m_running = false; @@ -651,8 +651,8 @@ namespace Mantid if (m_isChildAlgorithm || m_runningAsync || m_rethrow) throw; else { - g_log.error()<< "Logic Error in execution of algorithm "<< this->name()<<std::endl; - g_log.error()<< ex.what()<<std::endl; + getLogger().error() << "Logic Error in execution of algorithm "<< this->name() << std::endl + << ex.what()<<std::endl; } notificationCenter().postNotification(new ErrorNotification(this,ex.what())); m_running = false; @@ -662,7 +662,7 @@ namespace Mantid { m_runningAsync = false; m_running = false; - g_log.error() << this->name() << ": Execution terminated by user.\n"; + getLogger().error() << this->name() << ": Execution terminated by user.\n"; notificationCenter().postNotification(new ErrorNotification(this,ex.what())); this->unlockWorkspaces(); throw; @@ -675,8 +675,8 @@ namespace Mantid m_running = false; notificationCenter().postNotification(new ErrorNotification(this,ex.what())); - g_log.error() << "Error in execution of algorithm " << this->name() << ":\n"; - g_log.error(ex.what()); + getLogger().error() << "Error in execution of algorithm " << this->name() << ":\n" + << ex.what() << "\n"; this->unlockWorkspaces(); throw; } @@ -689,7 +689,7 @@ namespace Mantid m_running = false; notificationCenter().postNotification(new ErrorNotification(this,"UNKNOWN Exception is caught in exec()")); - g_log.error() << this->name() << ": UNKNOWN Exception is caught in exec()\n"; + getLogger().error() << this->name() << ": UNKNOWN Exception is caught in exec()\n"; this->unlockWorkspaces(); throw; } @@ -718,13 +718,11 @@ namespace Mantid } catch (std::runtime_error&) { - g_log.error() << "Unable to successfully run ChildAlgorithm " << this->name() << std::endl; throw; } if ( ! executed ) { - g_log.error() << "Unable to successfully run ChildAlgorithm " << this->name() << std::endl; throw std::runtime_error("Unable to successfully run ChildAlgorithm " + this->name()); } } @@ -754,7 +752,6 @@ namespace Mantid } catch (std::runtime_error&) { - g_log.error("Error storing output workspace in AnalysisDataService"); throw; } } @@ -778,7 +775,6 @@ namespace Mantid } catch (std::runtime_error&) { - g_log.error("Error storing output workspace in AnalysisDataService"); throw; } } @@ -813,8 +809,7 @@ namespace Mantid } catch (std::runtime_error& exc) { - g_log.error() << "Unable to initialise Child Algorithm " << name << std::endl; - g_log.error() << exc.what() << "\n"; + throw std::runtime_error("Unable to initialise Child Algorithm '" + name + "'"); } // If output workspaces are nameless, give them a temporary name to satisfy validator @@ -1074,13 +1069,15 @@ namespace Mantid /** Sends out algorithm parameter information to the logger */ void Algorithm::logAlgorithmInfo() const { - g_log.notice() << name() << " started"; + auto & logger = getLogger(); + + logger.notice() << name() << " started"; if (this->isChild()) - g_log.notice() << " (child)"; - g_log.notice() << std::endl; + logger.notice() << " (child)"; + logger.notice() << std::endl; // Make use of the AlgorithmHistory class, which holds all the info we want here AlgorithmHistory AH(this); - g_log.information() << AH; + logger.information() << AH; } diff --git a/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp b/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp index b5d752cbaaf2f1587de2a0d5673cac47f589e4ac..152a3215f4226d713921a999ee34eab1d876bbaa 100644 --- a/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp +++ b/Code/Mantid/Framework/API/src/AlgorithmFactory.cpp @@ -14,10 +14,14 @@ namespace Mantid { namespace API { + namespace + { + /// static logger instance + Kernel::Logger g_log("AlgorithmFactory"); + } - AlgorithmFactoryImpl::AlgorithmFactoryImpl() : - Kernel::DynamicFactory<Algorithm>(), g_log(Kernel::Logger::get("AlgorithmFactory")), - m_vmap() + AlgorithmFactoryImpl::AlgorithmFactoryImpl() + : Kernel::DynamicFactory<Algorithm>(), m_vmap() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does diff --git a/Code/Mantid/Framework/API/src/AlgorithmManager.cpp b/Code/Mantid/Framework/API/src/AlgorithmManager.cpp index 3c7783f744e99f8a6bd94d18dbd78954bd986eb7..bb61eed4a5055802f32deb1ddac81c899efcc606 100644 --- a/Code/Mantid/Framework/API/src/AlgorithmManager.cpp +++ b/Code/Mantid/Framework/API/src/AlgorithmManager.cpp @@ -14,9 +14,15 @@ namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("AlgorithmManager"); + } + /// Private Constructor for singleton class - AlgorithmManagerImpl::AlgorithmManagerImpl(): g_log(Kernel::Logger::get("AlgorithmManager")),m_managed_algs() + AlgorithmManagerImpl::AlgorithmManagerImpl() : m_managed_algs() { if ( ! Kernel::ConfigService::Instance().getValue("algorithms.retained",m_max_no_algs) || m_max_no_algs < 1 ) { diff --git a/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp b/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp index b1922ed55483d3be5c0ae9d92c140fda0a85714a..a75396630a3b0e29c9083ebf5340ce4992f018ec 100644 --- a/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp +++ b/Code/Mantid/Framework/API/src/AlgorithmProxy.cpp @@ -17,9 +17,6 @@ namespace Mantid namespace API { - // Get a reference to the logger - Kernel::Logger& AlgorithmProxy::g_log = Kernel::Logger::get("AlgorithmProxy"); - //---------------------------------------------------------------------- // Public methods //---------------------------------------------------------------------- @@ -34,7 +31,6 @@ namespace Mantid { if (!alg) { - g_log.error("Unable to create a proxy algorithm."); throw std::logic_error("Unable to create a proxy algorithm."); } alg->initialize(); diff --git a/Code/Mantid/Framework/API/src/CatalogFactory.cpp b/Code/Mantid/Framework/API/src/CatalogFactory.cpp index 5259ee6edeba497d545d10383bb47e2ca3ec8c03..6aa845f93c73bdfb8abf1ef39e89adaaac134bc8 100644 --- a/Code/Mantid/Framework/API/src/CatalogFactory.cpp +++ b/Code/Mantid/Framework/API/src/CatalogFactory.cpp @@ -1,5 +1,4 @@ #include "MantidAPI/CatalogFactory.h" -#include "MantidKernel/Logger.h" namespace Mantid { @@ -7,7 +6,7 @@ namespace Mantid { /// Constructor CatalogFactoryImpl::CatalogFactoryImpl() : - Kernel::DynamicFactory<ICatalog>(), m_createdCatalogs(), m_log(Kernel::Logger::get("CatalogFactory")) {} + Kernel::DynamicFactory<ICatalog>(), m_createdCatalogs() {} /// Destructor CatalogFactoryImpl::~CatalogFactoryImpl(){} } diff --git a/Code/Mantid/Framework/API/src/Column.cpp b/Code/Mantid/Framework/API/src/Column.cpp index 55152fdfc3733eef5afd01c6a1cb0b5a41c42fe1..81c7376f60d065081ed2e029a1f9802fbaf51a2d 100644 --- a/Code/Mantid/Framework/API/src/Column.cpp +++ b/Code/Mantid/Framework/API/src/Column.cpp @@ -1,4 +1,5 @@ #include "MantidAPI/Column.h" +#include "MantidKernel/Logger.h" #include <algorithm> #include <iostream> @@ -7,8 +8,11 @@ namespace Mantid namespace API { -// Get a reference to the logger -Kernel::Logger& Column::g_log = Kernel::Logger::get("Column"); +namespace +{ + /// static logger object + Kernel::Logger g_log("Column"); +} template<> bool Column::isType<bool>()const diff --git a/Code/Mantid/Framework/API/src/ColumnFactory.cpp b/Code/Mantid/Framework/API/src/ColumnFactory.cpp index 23fff01b0dec03a7fbb5ad7ee53021e2ad1c98b0..32ead8e03a4dca5c96252bcb3fbd6abb1ec82de5 100644 --- a/Code/Mantid/Framework/API/src/ColumnFactory.cpp +++ b/Code/Mantid/Framework/API/src/ColumnFactory.cpp @@ -2,26 +2,26 @@ #include <sstream> #include "MantidAPI/ColumnFactory.h" #include "MantidAPI/Column.h" -#include "MantidKernel/Logger.h" + namespace Mantid { namespace API { - ColumnFactoryImpl::ColumnFactoryImpl() : Kernel::DynamicFactory<API::Column>(), g_log(Kernel::Logger::get("ColumnFactory")) - { - } + ColumnFactoryImpl::ColumnFactoryImpl() : Kernel::DynamicFactory<API::Column>() + { + } - ColumnFactoryImpl::~ColumnFactoryImpl() - { - } + ColumnFactoryImpl::~ColumnFactoryImpl() + { + } - boost::shared_ptr<Column> ColumnFactoryImpl::create(const std::string& type) const - { - boost::shared_ptr<Column> c = Kernel::DynamicFactory<Column>::create(type); - c->m_type = type; - return c; - } + boost::shared_ptr<Column> ColumnFactoryImpl::create(const std::string& type) const + { + boost::shared_ptr<Column> c = Kernel::DynamicFactory<Column>::create(type); + c->m_type = type; + return c; + } } // namespace API diff --git a/Code/Mantid/Framework/API/src/CompositeFunction.cpp b/Code/Mantid/Framework/API/src/CompositeFunction.cpp index 18ab56cd421129714feb6677ce93bb03d112025c..bc10f9f67d349afd69fc2656543010706c84ebdc 100644 --- a/Code/Mantid/Framework/API/src/CompositeFunction.cpp +++ b/Code/Mantid/Framework/API/src/CompositeFunction.cpp @@ -32,11 +32,13 @@ To define a composite function inside a composite function enclose the inner one //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- -#include "MantidKernel/Exception.h" #include "MantidAPI/CompositeFunction.h" #include "MantidAPI/ParameterTie.h" #include "MantidAPI/IConstraint.h" #include "MantidAPI/FunctionFactory.h" +#include "MantidKernel/Exception.h" +#include "MantidKernel/Logger.h" + #include <boost/lexical_cast.hpp> #include <boost/shared_array.hpp> @@ -49,6 +51,12 @@ namespace Mantid namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("CompositeFunction"); + } + using std::size_t; DECLARE_FUNCTION(CompositeFunction) diff --git a/Code/Mantid/Framework/API/src/ConstraintFactory.cpp b/Code/Mantid/Framework/API/src/ConstraintFactory.cpp index e12847ea36956f66fc513237f650a2046b36d8c4..119994e08697172fb0298cb3ad04e541751bd9e2 100644 --- a/Code/Mantid/Framework/API/src/ConstraintFactory.cpp +++ b/Code/Mantid/Framework/API/src/ConstraintFactory.cpp @@ -1,7 +1,6 @@ #include "MantidAPI/ConstraintFactory.h" #include "MantidAPI/Expression.h" #include "MantidAPI/IConstraint.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/LibraryManager.h" #include <Poco/StringTokenizer.h> @@ -10,13 +9,12 @@ namespace Mantid namespace API { - ConstraintFactoryImpl::ConstraintFactoryImpl() : Kernel::DynamicFactory<IConstraint>(), g_log(Kernel::Logger::get("ConstraintFactory")) + ConstraintFactoryImpl::ConstraintFactoryImpl() : Kernel::DynamicFactory<IConstraint>() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does // not close any loaded DLLs with loaded algorithms in them Mantid::Kernel::LibraryManager::Instance(); - g_log.debug() << "ConstraintFactory created." << std::endl; } ConstraintFactoryImpl::~ConstraintFactoryImpl() diff --git a/Code/Mantid/Framework/API/src/CostFunctionFactory.cpp b/Code/Mantid/Framework/API/src/CostFunctionFactory.cpp index b7b5d21f156eaaca058a461f38f8c9a21e3ce390..a7acefcb31631c9cc47b4acbba8894a497639498 100644 --- a/Code/Mantid/Framework/API/src/CostFunctionFactory.cpp +++ b/Code/Mantid/Framework/API/src/CostFunctionFactory.cpp @@ -1,6 +1,5 @@ #include "MantidAPI/CostFunctionFactory.h" #include "MantidAPI/ICostFunction.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/LibraryManager.h" #include <iostream> @@ -9,13 +8,12 @@ namespace Mantid namespace API { - CostFunctionFactoryImpl::CostFunctionFactoryImpl() : Kernel::DynamicFactory<ICostFunction>(), g_log(Kernel::Logger::get("CostFunctionFactory")) + CostFunctionFactoryImpl::CostFunctionFactoryImpl() : Kernel::DynamicFactory<ICostFunction>() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does // not close any loaded DLLs with loaded algorithms in them Mantid::Kernel::LibraryManager::Instance(); - g_log.debug() << "CostFunctionFactory created." << std::endl; } } // namespace API diff --git a/Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp b/Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp index dbb8c4ce05735f076abd748e83b1def540dc251a..e91516e0826ba34e11ae886a0483bd6e76bc7a05 100644 --- a/Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp +++ b/Code/Mantid/Framework/API/src/DataProcessorAlgorithm.cpp @@ -234,7 +234,7 @@ namespace API } else { - g_log.notice() << "Could not find property manager" << std::endl; + getLogger().notice() << "Could not find property manager" << std::endl; processProperties = boost::make_shared<PropertyManager>(); PropertyManagerDataService::Instance().addOrReplace(propertyManager, processProperties); } diff --git a/Code/Mantid/Framework/API/src/ExperimentInfo.cpp b/Code/Mantid/Framework/API/src/ExperimentInfo.cpp index 6a33fa9e5dad2b0ba51f091685f2c82b92347ceb..e5b056cbe0201f81d96d5d7312f7390b8b1dcca1 100644 --- a/Code/Mantid/Framework/API/src/ExperimentInfo.cpp +++ b/Code/Mantid/Framework/API/src/ExperimentInfo.cpp @@ -36,8 +36,11 @@ namespace Mantid { namespace API { - - Kernel::Logger& ExperimentInfo::g_log = Kernel::Logger::get("ExperimentInfo"); + namespace + { + /// static logger object + Kernel::Logger g_log("ExperimentInfo"); + } //---------------------------------------------------------------------------------------------- /** Constructor diff --git a/Code/Mantid/Framework/API/src/FileFinder.cpp b/Code/Mantid/Framework/API/src/FileFinder.cpp index f2653845f2588dd2788e8a8521b8e59186085acf..5d46edb8ac51d450248c91be7f6865164c823efc 100644 --- a/Code/Mantid/Framework/API/src/FileFinder.cpp +++ b/Code/Mantid/Framework/API/src/FileFinder.cpp @@ -26,6 +26,9 @@ namespace { + /// static logger object + Mantid::Kernel::Logger g_log("FileFinder"); + /** * Unary predicate for use with remove_if. Checks for the existance of * a "*" wild card in the file extension string passed to it. @@ -56,7 +59,7 @@ namespace Mantid /** * Default constructor */ - FileFinderImpl::FileFinderImpl() : g_log(Mantid::Kernel::Logger::get("FileFinderImpl")) + FileFinderImpl::FileFinderImpl() { // Make sure plugins are loaded std::string libpath = Kernel::ConfigService::Instance().getString("plugins.directory"); diff --git a/Code/Mantid/Framework/API/src/FileLoaderRegistry.cpp b/Code/Mantid/Framework/API/src/FileLoaderRegistry.cpp index a94e14a42e5ee0b4bd77adc35d23463133f677a8..6edc818909de26275471320224f3b1c30aa7b595 100644 --- a/Code/Mantid/Framework/API/src/FileLoaderRegistry.cpp +++ b/Code/Mantid/Framework/API/src/FileLoaderRegistry.cpp @@ -166,7 +166,7 @@ namespace Mantid */ FileLoaderRegistryImpl::FileLoaderRegistryImpl() : m_names(2, std::multimap<std::string,int>()), m_totalSize(0), - m_log(Kernel::Logger::get("FileLoaderRegistry")) + m_log("FileLoaderRegistry") { } diff --git a/Code/Mantid/Framework/API/src/FrameworkManager.cpp b/Code/Mantid/Framework/API/src/FrameworkManager.cpp index 71c02c39b831749db7e6443d36420d5d862ee00c..2940b0259144b994be18219ffaa9dcacdb1135c4 100644 --- a/Code/Mantid/Framework/API/src/FrameworkManager.cpp +++ b/Code/Mantid/Framework/API/src/FrameworkManager.cpp @@ -26,6 +26,11 @@ namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("FrameworkManager"); + } /** This is a function called every time NeXuS raises an error. * This swallows the errors and outputs nothing. @@ -42,9 +47,9 @@ namespace API /// Default constructor -FrameworkManagerImpl::FrameworkManagerImpl() : g_log(Kernel::Logger::get("FrameworkManager")) +FrameworkManagerImpl::FrameworkManagerImpl() #ifdef MPI_BUILD - , m_mpi_environment() + m_mpi_environment() #endif { // Mantid only understands English... @@ -108,7 +113,7 @@ void FrameworkManagerImpl::loadAllPlugins() } else { - this->g_log.debug("Cannot load ParaView libraries"); + g_log.debug("Cannot load ParaView libraries"); } } @@ -122,12 +127,12 @@ void FrameworkManagerImpl::loadPluginsUsingKey(const std::string & key) std::string pluginDir = config.getString(key); if (pluginDir.length() > 0) { - this->g_log.debug("Loading libraries from \"" + pluginDir + "\""); + g_log.debug("Loading libraries from \"" + pluginDir + "\""); Kernel::LibraryManager::Instance().OpenAllLibraries(pluginDir, false); } else { - this->g_log.debug("No library directory found in key \"" + key + "\""); + g_log.debug("No library directory found in key \"" + key + "\""); } } diff --git a/Code/Mantid/Framework/API/src/FuncMinimizerFactory.cpp b/Code/Mantid/Framework/API/src/FuncMinimizerFactory.cpp index c6cdd35d6e66a5ae299a913fdf4ce9d5cdb5f537..b8f38072f8b06feee67b5484f1d81932a2c9177f 100644 --- a/Code/Mantid/Framework/API/src/FuncMinimizerFactory.cpp +++ b/Code/Mantid/Framework/API/src/FuncMinimizerFactory.cpp @@ -1,7 +1,6 @@ #include "MantidAPI/FuncMinimizerFactory.h" #include "MantidAPI/IFuncMinimizer.h" #include "MantidAPI/Expression.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/LibraryManager.h" #include <stdexcept> @@ -11,13 +10,12 @@ namespace Mantid namespace API { -FuncMinimizerFactoryImpl::FuncMinimizerFactoryImpl() : Kernel::DynamicFactory<IFuncMinimizer>(), g_log(Kernel::Logger::get("FuncMinimizerFactory")) +FuncMinimizerFactoryImpl::FuncMinimizerFactoryImpl() : Kernel::DynamicFactory<IFuncMinimizer>() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does // not close any loaded DLLs with loaded algorithms in them Mantid::Kernel::LibraryManager::Instance(); - g_log.debug() << "FuncMinimizerFactory created." << std::endl; } /** @@ -42,7 +40,6 @@ boost::shared_ptr<IFuncMinimizer> FuncMinimizerFactoryImpl::createMinimizer(cons if ( n == 0 ) { std::string mess = "Found empty initialization string"; - g_log.error(mess); throw std::invalid_argument(mess); } diff --git a/Code/Mantid/Framework/API/src/FunctionFactory.cpp b/Code/Mantid/Framework/API/src/FunctionFactory.cpp index 0b81cca608ffdc595729c51ffb2787b43784a865..bfb9b1163ce5dfeb835d435fd509359e0d253dad 100644 --- a/Code/Mantid/Framework/API/src/FunctionFactory.cpp +++ b/Code/Mantid/Framework/API/src/FunctionFactory.cpp @@ -7,7 +7,6 @@ #include "MantidAPI/IConstraint.h" #include "MantidAPI/Workspace.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/LibraryManager.h" #include <Poco/StringTokenizer.h> #include <sstream> @@ -17,13 +16,12 @@ namespace Mantid namespace API { - FunctionFactoryImpl::FunctionFactoryImpl() : Kernel::DynamicFactory<IFunction>(), g_log(Kernel::Logger::get("FunctionFactory")) + FunctionFactoryImpl::FunctionFactoryImpl() : Kernel::DynamicFactory<IFunction>() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does // not close any loaded DLLs with loaded algorithms in them Mantid::Kernel::LibraryManager::Instance(); - g_log.debug() << "FunctionFactory created." << std::endl; } FunctionFactoryImpl::~FunctionFactoryImpl() diff --git a/Code/Mantid/Framework/API/src/FunctionProperty.cpp b/Code/Mantid/Framework/API/src/FunctionProperty.cpp index 339c391b0014d5c31cf8c968fe7cc06c6cdad499..0af49aabfe2625280ac76d1c8ca72dda359f0e97 100644 --- a/Code/Mantid/Framework/API/src/FunctionProperty.cpp +++ b/Code/Mantid/Framework/API/src/FunctionProperty.cpp @@ -6,8 +6,6 @@ namespace Mantid { namespace API { - Kernel::Logger& FunctionProperty::g_log = Kernel::Logger::get("FunctionProperty"); - /** Constructor. * Sets the property names but initialises the function pointer to null. * @param name :: The name to assign to the property diff --git a/Code/Mantid/Framework/API/src/GridDomain.cpp b/Code/Mantid/Framework/API/src/GridDomain.cpp index 7ab4e93959940bf33538a35545e6e828d6c23716..2b3869ec48dddf2c6529c8258c9dc419ffb40433 100644 --- a/Code/Mantid/Framework/API/src/GridDomain.cpp +++ b/Code/Mantid/Framework/API/src/GridDomain.cpp @@ -6,13 +6,17 @@ #include <stdexcept> #include "MantidAPI/GridDomain.h" +#include "MantidKernel/Logger.h" namespace Mantid { namespace API { - -Kernel::Logger& GridDomain::g_log = Kernel::Logger::get("GridDomain"); + namespace + { + /// static logger + Kernel::Logger g_log("GridDomain"); + } /// number of points in the grid size_t GridDomain::size() const{ @@ -45,7 +49,6 @@ GridDomain_sptr GridDomain::getGrid(size_t index) catch(std::out_of_range &ex) { g_log.error( ex.what() ); - } return g; } diff --git a/Code/Mantid/Framework/API/src/IFunction.cpp b/Code/Mantid/Framework/API/src/IFunction.cpp index a4b30f9435fcfe51bd885fb2b7ba0a7fed376576..b3757ed84363118d184dea97203b9a092c947b27 100644 --- a/Code/Mantid/Framework/API/src/IFunction.cpp +++ b/Code/Mantid/Framework/API/src/IFunction.cpp @@ -35,10 +35,14 @@ namespace Mantid { namespace API { - using namespace Geometry; - Kernel::Logger& IFunction::g_log = Kernel::Logger::get("IFunction"); + namespace + { + /// static logger + Kernel::Logger g_log("IFunction"); + } + /** * Destructor diff --git a/Code/Mantid/Framework/API/src/IFunction1D.cpp b/Code/Mantid/Framework/API/src/IFunction1D.cpp index 311b3446c9128777689813e150da6f12beafcd37..0d6b46dd4818752bedb685ac4e1f7aa834e91463 100644 --- a/Code/Mantid/Framework/API/src/IFunction1D.cpp +++ b/Code/Mantid/Framework/API/src/IFunction1D.cpp @@ -30,7 +30,6 @@ namespace Mantid namespace API { using namespace Geometry; - Kernel::Logger& IFunction1D::g_log = Kernel::Logger::get("IFunction1D"); void IFunction1D::function(const FunctionDomain& domain, FunctionValues& values) const { diff --git a/Code/Mantid/Framework/API/src/IFunctionMD.cpp b/Code/Mantid/Framework/API/src/IFunctionMD.cpp index 44d7820ea062270e96a11b6caa7e35e817830af6..55e475534cdfc1e09080ee2efb67115724e4adaa 100644 --- a/Code/Mantid/Framework/API/src/IFunctionMD.cpp +++ b/Code/Mantid/Framework/API/src/IFunctionMD.cpp @@ -8,7 +8,6 @@ #include "MantidAPI/IMDIterator.h" #include "MantidAPI/IConstraint.h" #include "MantidAPI/FunctionDomainMD.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/Exception.h" #include "MantidGeometry/muParser_Silent.h" @@ -28,8 +27,6 @@ namespace API { using namespace Geometry; - Kernel::Logger& IFunctionMD::g_log = Kernel::Logger::get("IFunctionMD"); - /// Virtual copy constructor boost::shared_ptr<IFunction> IFunctionMD::clone() const { @@ -71,7 +68,6 @@ namespace API } catch(std::exception& e) { - g_log.error() << "IFunctionMD::setWorkspace failed with error: " << e.what() << '\n'; throw; } diff --git a/Code/Mantid/Framework/API/src/IFunctionMW.cpp b/Code/Mantid/Framework/API/src/IFunctionMW.cpp index 9893d9a4877c3d66a7b5ae53dcd61bee6503c5ed..b174c3427f1e452e3b921ca4a3bd1662fba78d4b 100644 --- a/Code/Mantid/Framework/API/src/IFunctionMW.cpp +++ b/Code/Mantid/Framework/API/src/IFunctionMW.cpp @@ -11,8 +11,6 @@ namespace API { using namespace Geometry; - Kernel::Logger& IFunctionMW::g_log = Kernel::Logger::get("IFunctionMW"); - /** Initialize the function providing it the workspace * @param workspace :: The workspace to set * @param wi :: The workspace index diff --git a/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp b/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp index 1bdacae671fc2ec1b2ed297d1d622793c0e7d3d8..aa65b994a37996d31f10527e7d59f681030e17ea 100644 --- a/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp +++ b/Code/Mantid/Framework/API/src/IPowderDiffPeakFunction.cpp @@ -175,7 +175,6 @@ namespace API // Throw exception if tried to reset the miller index stringstream errss; errss << "Profile function " << name() << "cannot have (HKL) reset."; - g_log.error(errss.str()); throw runtime_error(errss.str()); } else @@ -194,7 +193,6 @@ namespace API { stringstream errmsg; errmsg << "H = K = L = 0 is not allowed"; - g_log.error(errmsg.str()); throw std::invalid_argument(errmsg.str()); } diff --git a/Code/Mantid/Framework/API/src/ITableWorkspace.cpp b/Code/Mantid/Framework/API/src/ITableWorkspace.cpp index 1133c5b67fdb7d88f0d49f1f2b80a840a23f4f92..738a338a666038750e1870cc2c4c8f16ac9bca26 100644 --- a/Code/Mantid/Framework/API/src/ITableWorkspace.cpp +++ b/Code/Mantid/Framework/API/src/ITableWorkspace.cpp @@ -1,6 +1,5 @@ #include "MantidAPI/ITableWorkspace.h" #include "MantidAPI/AnalysisDataService.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/IPropertyManager.h" namespace Mantid @@ -8,9 +7,6 @@ namespace Mantid namespace API { -// Get a reference to the logger -Kernel::Logger& ITableWorkspace::g_log = Kernel::Logger::get("ITableWorkspace"); - /** */ const std::string ITableWorkspace::toString() const diff --git a/Code/Mantid/Framework/API/src/ITransformScale.cpp b/Code/Mantid/Framework/API/src/ITransformScale.cpp deleted file mode 100644 index 4c93b46e6afea63bcadc0b868f79995e6c36531f..0000000000000000000000000000000000000000 --- a/Code/Mantid/Framework/API/src/ITransformScale.cpp +++ /dev/null @@ -1,14 +0,0 @@ -//---------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------- - -#include "MantidAPI/ITransformScale.h" - -namespace Mantid -{ -namespace API -{ -Kernel::Logger& ITransformScale::g_log = Kernel::Logger::get("ITransformScale"); - -} // namespace API -} // namespace Mantid diff --git a/Code/Mantid/Framework/API/src/LiveListenerFactory.cpp b/Code/Mantid/Framework/API/src/LiveListenerFactory.cpp index 33bbe3512ca435c34a5adcf76cd3f4b0d4a4bc87..130ab94aa9cab16fef2696956ab42719722ced13 100644 --- a/Code/Mantid/Framework/API/src/LiveListenerFactory.cpp +++ b/Code/Mantid/Framework/API/src/LiveListenerFactory.cpp @@ -10,9 +10,13 @@ namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("LiveListenerFactory"); + } - LiveListenerFactoryImpl::LiveListenerFactoryImpl() : Kernel::DynamicFactory<ILiveListener>(), - m_log(Kernel::Logger::get("LiveListenerFactory")) + LiveListenerFactoryImpl::LiveListenerFactoryImpl() : Kernel::DynamicFactory<ILiveListener>() { } @@ -41,7 +45,7 @@ namespace API // If we can't connect, log and throw an exception std::stringstream ss; ss << "Unable to connect listener " << listener->name() << " to " << inst.liveDataAddress(); - m_log.debug(ss.str()); + g_log.debug(ss.str()); throw std::runtime_error(ss.str()); } } catch ( Kernel::Exception::NotFoundError& ) @@ -60,7 +64,7 @@ namespace API { std::stringstream ss; ss << "Unable to connect listener " << listener->name() << " to " << instrumentName << ": " << pocoEx.what(); - m_log.debug(ss.str()); + g_log.debug(ss.str()); throw std::runtime_error(ss.str()); } diff --git a/Code/Mantid/Framework/API/src/LogManager.cpp b/Code/Mantid/Framework/API/src/LogManager.cpp index 7bd9a55bac8af53108329c4ddd1c5f404648a220..8f9f9c99af881ab5d2cc1e1150f145ba815cbfd2 100644 --- a/Code/Mantid/Framework/API/src/LogManager.cpp +++ b/Code/Mantid/Framework/API/src/LogManager.cpp @@ -21,8 +21,11 @@ namespace API using namespace Kernel; -// Get a reference to the logger -Kernel::Logger& LogManager::g_log = Kernel::Logger::get("LogManager"); + namespace + { + /// static logger + Logger g_log("LogManager"); + } /// Name of the log entry containing the proton charge when retrieved using getProtonCharge const char * LogManager::PROTON_CHARGE_LOG_NAME = "gd_prtn_chrg"; diff --git a/Code/Mantid/Framework/API/src/LogarithmScale.cpp b/Code/Mantid/Framework/API/src/LogarithmScale.cpp index 2d58eb320f0ea6e78cb1ac1051dc7255fec7c179..e5e78c43e605a6d861f3bceab3127543fed5fae7 100644 --- a/Code/Mantid/Framework/API/src/LogarithmScale.cpp +++ b/Code/Mantid/Framework/API/src/LogarithmScale.cpp @@ -7,11 +7,18 @@ #include "MantidAPI/LogarithmScale.h" #include "MantidAPI/TransformScaleFactory.h" +#include "MantidKernel/Logger.h" namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("LogarithmScale"); + } + DECLARE_TRANSFORMSCALE(LogarithmScale); diff --git a/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp b/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp index e05545273ced598d1d6bca1192f51001adac884c..601c7f9f843c611bcfb1ae9876df8edb15423abb 100644 --- a/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp +++ b/Code/Mantid/Framework/API/src/MatrixWorkspace.cpp @@ -25,7 +25,12 @@ namespace Mantid using namespace Geometry; using Kernel::V3D; - Kernel::Logger& MatrixWorkspace::g_log = Kernel::Logger::get("MatrixWorkspace"); + namespace + { + /// static logger + Kernel::Logger g_log("MatrixWorkspace"); + } + const std::string MatrixWorkspace::xDimensionId = "xDimension"; const std::string MatrixWorkspace::yDimensionId = "yDimension"; @@ -91,7 +96,6 @@ namespace Mantid // Check validity of arguments if (NVectors == 0 || XLength == 0 || YLength == 0) { - g_log.error("All arguments to init must be positive and non-zero"); throw std::out_of_range("All arguments to init must be positive and non-zero"); } @@ -105,7 +109,6 @@ namespace Mantid } catch(std::runtime_error& ex) { - g_log.error() << "Error initializing the workspace" << ex.what() << std::endl; throw; } @@ -205,10 +208,9 @@ namespace Mantid m_nearestNeighbours.reset(); } - catch (std::runtime_error & e) + catch (std::runtime_error &) { - g_log.error() << "MatrixWorkspace::rebuildSpectraMapping() error:" << std::endl; - throw &e; + throw; } } @@ -849,7 +851,6 @@ namespace Mantid { if ( axisIndex >= m_axes.size() ) { - g_log.error() << "Argument to getAxis (" << axisIndex << ") is invalid for this (" << m_axes.size() << " axis) workspace" << std::endl; throw Kernel::Exception::IndexError(axisIndex, m_axes.size(),"Argument to getAxis is invalid for this workspace"); } @@ -867,7 +868,6 @@ namespace Mantid // First check that axisIndex is in range if ( axisIndex >= m_axes.size() ) { - g_log.error() << "Value of axisIndex (" << axisIndex << ") is invalid for this (" << m_axes.size() << " axis) workspace" << std::endl; throw Kernel::Exception::IndexError(axisIndex, m_axes.size(),"Value of axisIndex is invalid for this workspace"); } // If we're OK, then delete the old axis and set the pointer to the new one @@ -1052,7 +1052,6 @@ namespace Mantid // Throw if there are no masked bins for this spectrum. The caller should check first using hasMaskedBins! if (it==m_masks.end()) { - g_log.error() << "There are no masked bins for spectrum index " << workspaceIndex << std::endl; throw Kernel::Exception::IndexError(workspaceIndex,0,"MatrixWorkspace::maskedBins"); } diff --git a/Code/Mantid/Framework/API/src/MemoryManager.cpp b/Code/Mantid/Framework/API/src/MemoryManager.cpp index 5e0a23eb3686f096e6088a6ea3a43488445b90ac..fb3b3fd9cd9198cd1c3d0928b8f0724840c42754 100644 --- a/Code/Mantid/Framework/API/src/MemoryManager.cpp +++ b/Code/Mantid/Framework/API/src/MemoryManager.cpp @@ -3,6 +3,7 @@ //---------------------------------------------------------------------- #include "MantidAPI/MemoryManager.h" #include "MantidKernel/ConfigService.h" +#include "MantidKernel/Logger.h" #include "MantidKernel/Memory.h" #ifdef USE_TCMALLOC @@ -17,10 +18,14 @@ namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("MemoryManager"); + } /// Private Constructor for singleton class MemoryManagerImpl::MemoryManagerImpl() : - g_log(Kernel::Logger::get("MemoryManager")), memoryCleared(0) { g_log.debug() << "Memory Manager created." << std::endl; diff --git a/Code/Mantid/Framework/API/src/MultiPeriodGroupAlgorithm.cpp b/Code/Mantid/Framework/API/src/MultiPeriodGroupAlgorithm.cpp index a6df61b8aeaada155b61595d78b3df493dbb4172..1508a16852074acb24063e52a7a89baef50df599 100644 --- a/Code/Mantid/Framework/API/src/MultiPeriodGroupAlgorithm.cpp +++ b/Code/Mantid/Framework/API/src/MultiPeriodGroupAlgorithm.cpp @@ -248,7 +248,6 @@ namespace Mantid IAlgorithm* alg = alg_sptr.get(); if(!alg) { - g_log.error()<<"CreateAlgorithm failed for "<<this->name()<<"("<<this->version()<<")"<<std::endl; throw std::runtime_error("Algorithm creation failed."); } alg->initialize(); diff --git a/Code/Mantid/Framework/API/src/MultipleFileProperty.cpp b/Code/Mantid/Framework/API/src/MultipleFileProperty.cpp index 31ff72271d7ec58f5e94303bfa8f31792b2869e3..3a3e723e3822ff35df65c59448124c6ebeeaa2d7 100644 --- a/Code/Mantid/Framework/API/src/MultipleFileProperty.cpp +++ b/Code/Mantid/Framework/API/src/MultipleFileProperty.cpp @@ -21,6 +21,9 @@ using namespace Mantid::API; namespace // anonymous { + /// static logger + Mantid::Kernel::Logger g_log("MultipleFileProperty"); + /** * Unary predicate for use with copy_if. Checks for the existance of * a "*" wild card in the file extension string passed to it. @@ -49,8 +52,7 @@ namespace API m_multiFileLoadingEnabled(), m_exts(), m_parser(), - m_defaultExt(""), - g_log(Kernel::Logger::get("MultipleFileProperty")) + m_defaultExt("") { std::string allowMultiFileLoading = Kernel::ConfigService::Instance().getString("loading.multifile"); diff --git a/Code/Mantid/Framework/API/src/ParamFunction.cpp b/Code/Mantid/Framework/API/src/ParamFunction.cpp index f2793e5ae890aad936cb0eb616534338c057c22c..42b8bc3a2b990c065ee1ede700bd4207ef55f9f3 100644 --- a/Code/Mantid/Framework/API/src/ParamFunction.cpp +++ b/Code/Mantid/Framework/API/src/ParamFunction.cpp @@ -2,6 +2,7 @@ // Includes //---------------------------------------------------------------------- #include "MantidKernel/Exception.h" +#include "MantidKernel/Logger.h" #include "MantidAPI/ParamFunction.h" #include "MantidAPI/IConstraint.h" #include "MantidAPI/ParameterTie.h" @@ -17,6 +18,11 @@ namespace Mantid { namespace API { + namespace + { + Kernel::Logger g_log("ParamFunction"); + } + /// Destructor ParamFunction::~ParamFunction() diff --git a/Code/Mantid/Framework/API/src/Run.cpp b/Code/Mantid/Framework/API/src/Run.cpp index bb98b5b83f111d9f9c32895b9fdca3333a647b46..0eb5b21265fd2472743cc46f740e14ed466e4b01 100644 --- a/Code/Mantid/Framework/API/src/Run.cpp +++ b/Code/Mantid/Framework/API/src/Run.cpp @@ -35,9 +35,11 @@ namespace const char * PEAK_RADIUS_GROUP = "peak_radius"; const char * INNER_BKG_RADIUS_GROUP = "inner_bkg_radius"; const char * OUTER_BKG_RADIUS_GROUP = "outer_bkg_radius"; + + /// static logger object + Kernel::Logger g_log("Run"); + } -// Get a reference to the logger -Kernel::Logger& Run::g_log = Kernel::Logger::get("Run"); //---------------------------------------------------------------------- // Public member functions @@ -212,7 +214,6 @@ Kernel::Logger& Run::g_log = Kernel::Logger::get("Run"); } catch (Exception::NotFoundError &) { - //g_log.information() << "proton_charge log value not found. Total proton charge set to 0.0\n"; this->setProtonCharge(0); return 0; } diff --git a/Code/Mantid/Framework/API/src/ScriptRepositoryFactory.cpp b/Code/Mantid/Framework/API/src/ScriptRepositoryFactory.cpp index 48d36a81306c0f97811abf9dcb12bbdb0db3072f..2df6808fc39c1f702da9663bf438b8da60cc3cd9 100644 --- a/Code/Mantid/Framework/API/src/ScriptRepositoryFactory.cpp +++ b/Code/Mantid/Framework/API/src/ScriptRepositoryFactory.cpp @@ -1,6 +1,5 @@ #include "MantidAPI/ScriptRepositoryFactory.h" #include "MantidAPI/ScriptRepository.h" -#include "MantidKernel/Logger.h" #include "MantidKernel/LibraryManager.h" #include <Poco/StringTokenizer.h> #include <sstream> @@ -10,13 +9,12 @@ namespace Mantid namespace API { - ScriptRepositoryFactoryImpl::ScriptRepositoryFactoryImpl() : Kernel::DynamicFactory<ScriptRepository>(), g_log(Kernel::Logger::get("ScriptRepositoryFactory")) + ScriptRepositoryFactoryImpl::ScriptRepositoryFactoryImpl() : Kernel::DynamicFactory<ScriptRepository>() { // we need to make sure the library manager has been loaded before we // are constructed so that it is destroyed after us and thus does // not close any loaded DLLs with loaded algorithms in them Mantid::Kernel::LibraryManager::Instance(); - g_log.debug() << "ScriptRepositoryFactory created." << std::endl; } ScriptRepositoryFactoryImpl::~ScriptRepositoryFactoryImpl() diff --git a/Code/Mantid/Framework/API/src/TableRow.cpp b/Code/Mantid/Framework/API/src/TableRow.cpp index 42edeb4d48ec69e8683eda245778fd3684e4275a..43520ae955b4438161cc1be487fa076dc83964a5 100644 --- a/Code/Mantid/Framework/API/src/TableRow.cpp +++ b/Code/Mantid/Framework/API/src/TableRow.cpp @@ -6,9 +6,6 @@ namespace Mantid namespace API { -// Get a reference to the logger -Kernel::Logger& TableRow::g_log = Kernel::Logger::get("TableRow"); - /** Constructor @param trh :: TableRowHelper returned by TableWorkspace::getRow */ @@ -33,7 +30,6 @@ void TableRow::row(size_t i) } else { - g_log.error("Row index out of range."); throw std::range_error("Row index out of range."); } } diff --git a/Code/Mantid/Framework/API/src/TransformScaleFactory.cpp b/Code/Mantid/Framework/API/src/TransformScaleFactory.cpp index 809a9d77e52595cb0aafa51147e5f7b15e317fbc..eb6e5adf9a18274e3a396a5a6f07b6b6bc699e38 100644 --- a/Code/Mantid/Framework/API/src/TransformScaleFactory.cpp +++ b/Code/Mantid/Framework/API/src/TransformScaleFactory.cpp @@ -1,7 +1,6 @@ #include "MantidAPI/TransformScaleFactory.h" #include "MantidAPI/ITransformScale.h" #include "MantidKernel/Logger.h" -#include "MantidKernel/ConfigService.h" using boost::shared_ptr; @@ -10,9 +9,13 @@ namespace Mantid { namespace API { + namespace + { + /// static logger + Kernel::Logger g_log("TransformScaleFactory"); + } - TransformScaleFactoryImpl::TransformScaleFactoryImpl() : Kernel::DynamicFactory<ITransformScale>(), - g_log(Kernel::Logger::get("TransformScaleFactory")) + TransformScaleFactoryImpl::TransformScaleFactoryImpl() : Kernel::DynamicFactory<ITransformScale>() { } diff --git a/Code/Mantid/Framework/API/src/WorkspaceFactory.cpp b/Code/Mantid/Framework/API/src/WorkspaceFactory.cpp index e794f8b0f9ec9e0b97d5f15d8eabe6a34307ea03..581d1e8bb81eb3345bb022317e0420f3cdfd343f 100644 --- a/Code/Mantid/Framework/API/src/WorkspaceFactory.cpp +++ b/Code/Mantid/Framework/API/src/WorkspaceFactory.cpp @@ -16,12 +16,17 @@ namespace Mantid { namespace API { + namespace + { + /// static logger object + Kernel::Logger g_log("WorkspaceFactory"); + } using std::size_t; /// Private constructor for singleton class WorkspaceFactoryImpl::WorkspaceFactoryImpl() : - Mantid::Kernel::DynamicFactory<Workspace>(), g_log(Kernel::Logger::get("WorkspaceFactory")) + Mantid::Kernel::DynamicFactory<Workspace>() { g_log.debug() << "WorkspaceFactory created." << std::endl; } @@ -32,7 +37,6 @@ WorkspaceFactoryImpl::WorkspaceFactoryImpl() : */ WorkspaceFactoryImpl::~WorkspaceFactoryImpl() { - // g_log.debug() << "WorkspaceFactory destroyed." << std::endl; } /** Create a new instance of the same type of workspace as that given as argument. @@ -180,7 +184,6 @@ MatrixWorkspace_sptr WorkspaceFactoryImpl::create(const std::string& className, MemoryInfo mi = MemoryManager::Instance().getMemoryInfo(); if ( static_cast<unsigned int>(blockMemory)*100/1024 > mi.availMemory ) { - g_log.error("There is not enough memory to allocate the workspace"); throw std::runtime_error("There is not enough memory to allocate the workspace"); } @@ -222,13 +225,11 @@ ITableWorkspace_sptr WorkspaceFactoryImpl::createTable(const std::string& classN ws = boost::dynamic_pointer_cast<ITableWorkspace>(this->create(className)); if (!ws) { - g_log.error("Class "+className+" cannot be cast to ITableWorkspace"); throw std::runtime_error("Class "+className+" cannot be cast to ITableWorkspace"); } } catch(Kernel::Exception::NotFoundError& e) { - g_log.error(e.what()); throw; } return ws; @@ -243,13 +244,11 @@ IPeaksWorkspace_sptr WorkspaceFactoryImpl::createPeaks(const std::string& classN ws = boost::dynamic_pointer_cast<IPeaksWorkspace>(this->create(className)); if (!ws) { - //g_log.error("Class "+className+" cannot be cast to IPeaksWorkspace"); throw std::runtime_error("Class "+className+" cannot be cast to IPeaksWorkspace"); } } catch(Kernel::Exception::NotFoundError& e) { - g_log.error(e.what()); throw; } return ws; diff --git a/Code/Mantid/Framework/API/src/WorkspaceGroup.cpp b/Code/Mantid/Framework/API/src/WorkspaceGroup.cpp index b53de355f408e4373e6e543f13b5b20cb0521a22..7993cae37d78c7349ccc517aa0e2a64b41c88812 100644 --- a/Code/Mantid/Framework/API/src/WorkspaceGroup.cpp +++ b/Code/Mantid/Framework/API/src/WorkspaceGroup.cpp @@ -13,9 +13,13 @@ namespace Mantid { namespace API { - -Kernel::Logger& WorkspaceGroup::g_log = Kernel::Logger::get("WorkspaceGroup"); -size_t WorkspaceGroup::g_maximum_depth = 100; + namespace + { + /// initialize depth parameter + size_t MAXIMUM_DEPTH = 100; + /// static logger object + Kernel::Logger g_log("WorkspaceGroup"); + } WorkspaceGroup::WorkspaceGroup() : Workspace(), @@ -393,7 +397,7 @@ bool WorkspaceGroup::isMultiperiod() const bool WorkspaceGroup::isInGroup(const Workspace &workspace, size_t level) const { // Check for a cycle. - if ( level > g_maximum_depth ) + if ( level > MAXIMUM_DEPTH ) { throw std::runtime_error("WorkspaceGroup nesting level is too deep."); } diff --git a/Code/Mantid/Framework/API/src/WorkspaceHistory.cpp b/Code/Mantid/Framework/API/src/WorkspaceHistory.cpp index 209bcb140666679901d197f01a997872aef1a4c5..67a9c738d3ee636b17388cd8dd51a4d9b11a3cdc 100644 --- a/Code/Mantid/Framework/API/src/WorkspaceHistory.cpp +++ b/Code/Mantid/Framework/API/src/WorkspaceHistory.cpp @@ -16,10 +16,14 @@ namespace Mantid { namespace API { + namespace + { + /// static logger object + Kernel::Logger g_log("WorkspaceHistory"); + } ///Default Constructor -WorkspaceHistory::WorkspaceHistory() : m_environment(), m_algorithms(), - g_log(Kernel::Logger::get("WorkspaceHistory")) +WorkspaceHistory::WorkspaceHistory() : m_environment(), m_algorithms() {} /// Destructor @@ -31,8 +35,7 @@ WorkspaceHistory::~WorkspaceHistory() @param A :: WorkspaceHistory Item to copy */ WorkspaceHistory::WorkspaceHistory(const WorkspaceHistory& A) : - m_environment(A.m_environment), m_algorithms(A.m_algorithms), - g_log(Kernel::Logger::get("WorkspaceHistory")) + m_environment(A.m_environment), m_algorithms(A.m_algorithms) {} /// Returns a const reference to the algorithmHistory