Poco

class LogStream

Library: Foundation
Package: Logging
Header: Poco/LogStream.h

Description

This class implements an ostream interface to a Logger.

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 Logger, with the current priority.

Usage example:

     LogStream ls(someLogger);
     ls << "Some informational message" << std::endl;
     ls.error() << "Some error message" << std::endl;

Inheritance

Direct Base Classes: LogIOS, std::ostream

All Base Classes: LogIOS, std::ios, std::ostream

Member Summary

Member Functions: critical, debug, error, fatal, information, notice, priority, trace, warning

Inherited Functions: rdbuf

Constructors

LogStream

LogStream(
    Logger & logger,
    Message::Priority priority = Message::PRIO_INFORMATION
);

Creates the LogStream, using the given logger and priority.

LogStream

LogStream(
    const std::string & loggerName,
    Message::Priority priority = Message::PRIO_INFORMATION
);

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

Destructor

~LogStream

~LogStream();

Destroys the LogStream.

Member Functions

critical

LogStream & critical();

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

debug

LogStream & debug();

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

error

LogStream & error();

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

fatal

LogStream & fatal();

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

information

LogStream & information();

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

notice

LogStream & notice();

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

priority

LogStream & priority(
    Message::Priority priority
);

Sets the priority for log messages.

trace

LogStream & trace();

Sets the priority for log messages to Message::PRIO_TRACE.

warning

LogStream & warning();

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