Skip to content

Commit

Permalink
Tidyup the Logger headers.
Browse files Browse the repository at this point in the history
Refs #8784
  • Loading branch information
martyngigg committed Feb 10, 2014
1 parent 86f31ee commit 99b95f0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions Code/Mantid/Framework/Kernel/inc/MantidKernel/Logger.h
Expand Up @@ -4,13 +4,12 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/MultiThreaded.h"
#include "MantidKernel/DllConfig.h"
#include <exception>
#include <ostream>

#include <Poco/Message.h>

#include <iosfwd>
#include <set>
#include <streambuf>
#include <string>

//----------------------------------------------------------------------
Expand All @@ -19,6 +18,7 @@
/// @cond Exclude from doxygen documentation
namespace Poco
{
class FastMutex;
class Logger;
class NullOutputStream;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ class ThreadSafeLogStream;
typedef Poco::Message::Priority Priority;

/// Sets the Loggername to a new value.
void setName(std::string newName);
void setName(const std::string & newName);
/// Logs at Fatal level
void fatal(const std::string& msg);
/// Logs at error level
Expand All @@ -88,16 +88,16 @@ class ThreadSafeLogStream;

/// Logs at Fatal level
std::ostream& fatal();
/// Logs at error level
/// Logs at error level
std::ostream& error();
/// Logs at warning level
/// Logs at warning level
std::ostream& warning();
/// Logs at notice level
std::ostream& notice();
/// Logs at notice level
std::ostream& notice();
/// Logs at information level
std::ostream& information();
/// Logs at debug level
std::ostream& debug();
std::ostream& debug();

/// Logs the given message at debug level, followed by the data in buffer.
void dump(const std::string& msg, const void* buffer, std::size_t length);
Expand All @@ -106,7 +106,7 @@ class ThreadSafeLogStream;
void setLevel(int level);

/// Sets the Logger's log offset level.
void setLevelOffset(int level);
void setLevelOffset(int level);

/// Gets the Logger's log offset level.
int getLevelOffset();
Expand Down Expand Up @@ -154,8 +154,8 @@ class ThreadSafeLogStream;
/// Overload of = operator
Logger& operator= (const Logger&);

/// Return a log stream set with the given priority
void log(const std::string message, Logger::Priority priority);
/// Log a message at a given priority
void log(const std::string & message, Logger::Priority priority);

/// gets the correct log stream for a priority
std::ostream& getLogStream(Logger::Priority priority);
Expand All @@ -180,7 +180,7 @@ class ThreadSafeLogStream;
/// The null stream that is used when logging is disabled
static Poco::NullOutputStream* m_nullStream;
/// Mutex to make changing the static logger list threadsafe.
static Mutex *mutexLoggerList;
static Poco::FastMutex *mutexLoggerList;
};

} // namespace Kernel
Expand Down
Expand Up @@ -4,6 +4,7 @@
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/IValidator.h"
#include <stdexcept>
#include <typeinfo>

namespace Mantid
Expand Down
10 changes: 5 additions & 5 deletions Code/Mantid/Framework/Kernel/src/Logger.cpp
Expand Up @@ -2,6 +2,7 @@
#include "MantidKernel/ThreadSafeLogStream.h"
#include <Poco/Logger.h>
#include <Poco/Message.h>
#include <Poco/Mutex.h>

#ifdef _MSC_VER
// Disable a flood of warnings about inheriting from std streams
Expand All @@ -24,7 +25,7 @@ namespace Kernel
{
// Initialize the static members
Logger::LoggerList* Logger::m_loggerList = NULL;
Mutex* Logger::mutexLoggerList = NULL;
Poco::FastMutex* Logger::mutexLoggerList = NULL;
Poco::NullOutputStream* Logger::m_nullStream = NULL;

/** Constructor
Expand All @@ -43,7 +44,7 @@ namespace Kernel
}

/// Sets the Loggername to a new value.
void Logger::setName(std::string newName)
void Logger::setName(const std::string & newName)
{
//delete the log stream
delete (m_logStream);
Expand Down Expand Up @@ -380,7 +381,7 @@ namespace Kernel
// MG: This method can be called to initialize static logger which means
// it may get called before mutexLoggerList has been initialized, i.e. the
// usual static initialization order problem.
if( mutexLoggerList == NULL ) mutexLoggerList = new Mutex();
if( mutexLoggerList == NULL ) mutexLoggerList = new Poco::FastMutex();
try
{ mutexLoggerList->lock(); }
catch(Poco::SystemException &)
Expand Down Expand Up @@ -409,11 +410,10 @@ namespace Kernel
}

/**
* Log a given message at a given priority
* @param message :: The message to log
* @param priority :: The priority level
*/
void Logger::log(const std::string message, Logger::Priority priority)
void Logger::log(const std::string & message, Logger::Priority priority)
{
if( !m_enabled ) return;

Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/Framework/Kernel/test/DataServiceTest.h
@@ -1,8 +1,8 @@
#ifndef MANTID_KERNEL_DATASERVICETEST_H_
#define MANTID_KERNEL_DATASERVICETEST_H_

#include "MantidKernel/CPUTimer.h"
#include "MantidKernel/DataService.h"
#include "MantidKernel/MultiThreaded.h"
#include <cxxtest/TestSuite.h>
#include <Poco/NObserver.h>
#include <boost/make_shared.hpp>
Expand Down Expand Up @@ -268,7 +268,6 @@ class DataServiceTest : public CxxTest::TestSuite
svc.add("object1", boost::make_shared<int>(12345));

int num = 5000;
CPUTimer tim;
PARALLEL_FOR_NO_WSP_CHECK()
for (int i=0; i<num; i++)
{
Expand Down

0 comments on commit 99b95f0

Please sign in to comment.