Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::Kernel::ThreadSafeLogStream Class Reference

The main log stream class implementing an ostream interface to a Logger. More...

#include <ThreadSafeLogStream.h>

Inheritance diagram for Mantid::Kernel::ThreadSafeLogStream:
Mantid::Kernel::ThreadSafeLogIOS

Public Member Functions

ThreadSafeLogStreamaccumulate (const std::string &message)
 accumulates the message to the accummulator buffer More...
 
ThreadSafeLogStreamcritical ()
 Sets the priority for log messages to Poco::Message::PRIO_CRITICAL. More...
 
ThreadSafeLogStreamcritical (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_CRITICAL and writes the given message. More...
 
ThreadSafeLogStreamdebug ()
 Sets the priority for log messages to Poco::Message::PRIO_DEBUG. More...
 
ThreadSafeLogStreamdebug (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_DEBUG and writes the given message. More...
 
ThreadSafeLogStreamerror ()
 Sets the priority for log messages to Poco::Message::PRIO_ERROR. More...
 
ThreadSafeLogStreamerror (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_ERROR and writes the given message. More...
 
ThreadSafeLogStreamfatal ()
 Sets the priority for log messages to Poco::Message::PRIO_FATAL. More...
 
ThreadSafeLogStreamfatal (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_FATAL and writes the given message. More...
 
std::string flush ()
 Returns and flushes the accumulated messages. More...
 
ThreadSafeLogStreaminformation ()
 Sets the priority for log messages to Poco::Message::PRIO_INFORMATION. More...
 
ThreadSafeLogStreaminformation (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_INFORMATION and writes the given message. More...
 
ThreadSafeLogStreamnotice ()
 Sets the priority for log messages to Poco::Message::PRIO_NOTICE. More...
 
ThreadSafeLogStreamnotice (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_NOTICE and writes the given message. More...
 
ThreadSafeLogStreampriority (Poco::Message::Priority priority)
 Sets the priority for log messages. More...
 
 ThreadSafeLogStream (const std::string &loggerName, Poco::Message::Priority priority=Poco::Message::PRIO_INFORMATION)
 Creates the ThreadSafeLogStream, using the logger identified by loggerName, and sets the priority. More...
 
 ThreadSafeLogStream (Poco::Logger &logger, Poco::Message::Priority priority=Poco::Message::PRIO_INFORMATION)
 Creates the ThreadSafeLogStream, using the given logger and priority. More...
 
ThreadSafeLogStreamwarning ()
 Sets the priority for log messages to Poco::Message::PRIO_WARNING. More...
 
ThreadSafeLogStreamwarning (const std::string &message)
 Sets the priority for log messages to Poco::Message::PRIO_WARNING and writes the given message. More...
 
- Public Member Functions inherited from Mantid::Kernel::ThreadSafeLogIOS
Poco::LogStreamBuf * rdbuf ()
 Return the underlying buffer for this stream. More...
 
 ThreadSafeLogIOS (Poco::Logger &logger, Poco::Message::Priority priority)
 Constructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::Kernel::ThreadSafeLogIOS
ThreadSafeLogStreamBuf m_buf
 The log stream buffer object. More...
 

Detailed Description

The main log stream class implementing an ostream interface to a Logger.

Nearly identical to the Poco::LogStream class but instead uses thread-safe buffering required for Mantid

The stream's buffer appends all characters written to it to a string. As soon as a CR or LF (std::endl) is written, the string is sent to the Poco::Logger, with the current priority.

Usage example: ThreadSafeLogStream ls(somePoco::Logger); ls << "Some informational message\n"; ls.error() << "Some error message\n";

Definition at line 97 of file ThreadSafeLogStream.h.

Constructor & Destructor Documentation

◆ ThreadSafeLogStream() [1/2]

ThreadSafeLogStream::ThreadSafeLogStream ( Poco::Logger &  logger,
Poco::Message::Priority  priority = Poco::Message::PRIO_INFORMATION 
)

Creates the ThreadSafeLogStream, using the given logger and priority.

Constructor.

Parameters
logger:: A reference to the logger associated with this stream
priority:: The stream priority

Definition at line 95 of file ThreadSafeLogStream.cpp.

◆ ThreadSafeLogStream() [2/2]

ThreadSafeLogStream::ThreadSafeLogStream ( const std::string &  loggerName,
Poco::Message::Priority  priority = Poco::Message::PRIO_INFORMATION 
)

Creates the ThreadSafeLogStream, using the logger identified by loggerName, and sets the priority.

Constructor taking a name for a logger.

Parameters
loggerName:: A name for the logger stream
priority:: The stream priority

Definition at line 103 of file ThreadSafeLogStream.cpp.

Member Function Documentation

◆ accumulate()

ThreadSafeLogStream & ThreadSafeLogStream::accumulate ( const std::string &  message)

accumulates the message to the accummulator buffer

accumulate a message

Parameters
message:: The log message
Returns
A reference to the log stream with the given priority level

Definition at line 240 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogStreamBuf::accumulate(), and Mantid::Kernel::ThreadSafeLogIOS::m_buf.

◆ critical() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::critical ( )

Sets the priority for log messages to Poco::Message::PRIO_CRITICAL.

Return a reference to the log stream with the priority set to critical.

Returns
A reference to the log stream with critical priority level

Definition at line 127 of file ThreadSafeLogStream.cpp.

References priority().

◆ critical() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::critical ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_CRITICAL and writes the given message.

Log a message as critical and return a reference to the log stream with the priority set to critical.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with critical priority level

Definition at line 135 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ debug() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::debug ( )

Sets the priority for log messages to Poco::Message::PRIO_DEBUG.

Return a reference to the log stream with the priority set to debug.

Returns
A reference to the log stream with debug priority level

Definition at line 212 of file ThreadSafeLogStream.cpp.

References priority().

◆ debug() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::debug ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_DEBUG and writes the given message.

Log a message as debug and return a reference to the log stream with the priority set to debug.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with debug priority level

Definition at line 220 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ error() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::error ( )

Sets the priority for log messages to Poco::Message::PRIO_ERROR.

Return a reference to the log stream with the priority set to error.

Returns
A reference to the log stream with error priority level

Definition at line 144 of file ThreadSafeLogStream.cpp.

References priority().

◆ error() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::error ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_ERROR and writes the given message.

Log a message as error and return a reference to the log stream with the priority set to error.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with error priority level

Definition at line 152 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ fatal() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::fatal ( )

Sets the priority for log messages to Poco::Message::PRIO_FATAL.

Return a reference to the log stream with the priority set to fatal.

Returns
A reference to the log stream with fatal priority level

Definition at line 110 of file ThreadSafeLogStream.cpp.

References priority().

◆ fatal() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::fatal ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_FATAL and writes the given message.

Log a message as fatal and return a reference to the log stream with the priority set to fatal.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with fatal priority level

Definition at line 118 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ flush()

std::string ThreadSafeLogStream::flush ( )

Returns and flushes the accumulated messages.

Flush the accumulated message.

Returns
The accumulated message

Definition at line 249 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogStreamBuf::flush(), and Mantid::Kernel::ThreadSafeLogIOS::m_buf.

◆ information() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::information ( )

Sets the priority for log messages to Poco::Message::PRIO_INFORMATION.

Return a reference to the log stream with the priority set to information.

Returns
A reference to the log stream with information priority level

Definition at line 195 of file ThreadSafeLogStream.cpp.

References priority().

◆ information() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::information ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_INFORMATION and writes the given message.

Log a message as information and return a reference to the log stream with the priority set to information.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with information priority level

Definition at line 203 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ notice() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::notice ( )

Sets the priority for log messages to Poco::Message::PRIO_NOTICE.

Return a reference tothe log stream with the priority set to notice.

Returns
A reference to the log stream with notice priority level

Definition at line 178 of file ThreadSafeLogStream.cpp.

References priority().

◆ notice() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::notice ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_NOTICE and writes the given message.

Log a message as a notice and return a reference to the log stream with the priority set to notice.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with notice priority level

Definition at line 186 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

◆ priority()

ThreadSafeLogStream & ThreadSafeLogStream::priority ( Poco::Message::Priority  priority)

Sets the priority for log messages.

Return a reference to the log stream with the priority set at the given level.

Parameters
priority:: The priority level
Returns
A reference to the log stream with the given priority level

Definition at line 230 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().

Referenced by critical(), debug(), error(), fatal(), information(), notice(), priority(), and warning().

◆ warning() [1/2]

ThreadSafeLogStream & ThreadSafeLogStream::warning ( )

Sets the priority for log messages to Poco::Message::PRIO_WARNING.

Return a reference to the log stream with the priority set to warning.

Returns
A reference to the log stream with warning priority level

Definition at line 161 of file ThreadSafeLogStream.cpp.

References priority().

◆ warning() [2/2]

ThreadSafeLogStream & ThreadSafeLogStream::warning ( const std::string &  message)

Sets the priority for log messages to Poco::Message::PRIO_WARNING and writes the given message.

Log a message as a warning and return a reference to the log stream with the priority set to warning.

Parameters
message:: The string to send to the logger
Returns
A reference to the log stream with warning priority level

Definition at line 169 of file ThreadSafeLogStream.cpp.

References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().


The documentation for this class was generated from the following files: