Mantid
|
The main log stream class implementing an ostream interface to a Logger. More...
#include <ThreadSafeLogStream.h>
Public Member Functions | |
ThreadSafeLogStream & | accumulate (const std::string &message) |
accumulates the message to the accummulator buffer More... | |
ThreadSafeLogStream & | critical () |
Sets the priority for log messages to Poco::Message::PRIO_CRITICAL. More... | |
ThreadSafeLogStream & | critical (const std::string &message) |
Sets the priority for log messages to Poco::Message::PRIO_CRITICAL and writes the given message. More... | |
ThreadSafeLogStream & | debug () |
Sets the priority for log messages to Poco::Message::PRIO_DEBUG. More... | |
ThreadSafeLogStream & | debug (const std::string &message) |
Sets the priority for log messages to Poco::Message::PRIO_DEBUG and writes the given message. More... | |
ThreadSafeLogStream & | error () |
Sets the priority for log messages to Poco::Message::PRIO_ERROR. More... | |
ThreadSafeLogStream & | error (const std::string &message) |
Sets the priority for log messages to Poco::Message::PRIO_ERROR and writes the given message. More... | |
ThreadSafeLogStream & | fatal () |
Sets the priority for log messages to Poco::Message::PRIO_FATAL. More... | |
ThreadSafeLogStream & | fatal (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... | |
ThreadSafeLogStream & | information () |
Sets the priority for log messages to Poco::Message::PRIO_INFORMATION. More... | |
ThreadSafeLogStream & | information (const std::string &message) |
Sets the priority for log messages to Poco::Message::PRIO_INFORMATION and writes the given message. More... | |
ThreadSafeLogStream & | notice () |
Sets the priority for log messages to Poco::Message::PRIO_NOTICE. More... | |
ThreadSafeLogStream & | notice (const std::string &message) |
Sets the priority for log messages to Poco::Message::PRIO_NOTICE and writes the given message. More... | |
ThreadSafeLogStream & | priority (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... | |
ThreadSafeLogStream & | warning () |
Sets the priority for log messages to Poco::Message::PRIO_WARNING. More... | |
ThreadSafeLogStream & | warning (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... | |
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.
ThreadSafeLogStream::ThreadSafeLogStream | ( | Poco::Logger & | logger, |
Poco::Message::Priority | priority = Poco::Message::PRIO_INFORMATION |
||
) |
Creates the ThreadSafeLogStream, using the given logger and priority.
Constructor.
logger | :: A reference to the logger associated with this stream |
priority | :: The stream priority |
Definition at line 95 of file ThreadSafeLogStream.cpp.
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.
loggerName | :: A name for the logger stream |
priority | :: The stream priority |
Definition at line 103 of file ThreadSafeLogStream.cpp.
ThreadSafeLogStream & ThreadSafeLogStream::accumulate | ( | const std::string & | message | ) |
accumulates the message to the accummulator buffer
accumulate a message
message | :: The log message |
Definition at line 240 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogStreamBuf::accumulate(), and Mantid::Kernel::ThreadSafeLogIOS::m_buf.
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.
Definition at line 127 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 135 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().
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.
Definition at line 212 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 220 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().
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.
Definition at line 144 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 152 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().
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.
Definition at line 110 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 118 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().
std::string ThreadSafeLogStream::flush | ( | ) |
Returns and flushes the accumulated messages.
Flush the accumulated message.
Definition at line 249 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogStreamBuf::flush(), and Mantid::Kernel::ThreadSafeLogIOS::m_buf.
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.
Definition at line 195 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 203 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().
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.
Definition at line 178 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 186 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and 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.
priority | :: The 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().
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.
Definition at line 161 of file ThreadSafeLogStream.cpp.
References priority().
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.
message | :: The string to send to the logger |
Definition at line 169 of file ThreadSafeLogStream.cpp.
References Mantid::Kernel::ThreadSafeLogIOS::m_buf, and priority().