# 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.

### critical

LogStream & critical(
const std::string & message
);

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

### debug

LogStream & debug();

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

### debug

LogStream & debug(
const std::string & message
);

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

### error

LogStream & error();

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

### error

LogStream & error(
const std::string & message
);

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

### fatal

LogStream & fatal();

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

### fatal

LogStream & fatal(
const std::string & message
);

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

### information

LogStream & information();

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

### information

LogStream & information(
const std::string & message
);

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

### notice

LogStream & notice();

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

### notice

LogStream & notice(
const std::string & message
);

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

### 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.

### trace

LogStream & trace(
const std::string & message
);

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

### warning

LogStream & warning();

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

### warning

LogStream & warning(
const std::string & message
);

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