# Poco

# class ConsoleChannel

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

## Description

A channel that writes to an ostream.

Only the message's text is written, followed by a newline.

Chain this channel to a FormattingChannel with an appropriate Formatter to control what is contained in the text.

Similar to StreamChannel, except that a static mutex is used to protect against multiple console channels concurrently writing to the same stream.

## Inheritance

Direct Base Classes: Channel

All Base Classes: Channel, Configurable, RefCountedObject

## Member Summary

Member Functions: log

Inherited Functions: close, duplicate, getProperty, log, open, referenceCount, release, setProperty

## Types Aliases

### Ptr

using Ptr = AutoPtr < ConsoleChannel >;

## Constructors

### ConsoleChannel

ConsoleChannel();

Creates the channel and attaches std::clog.

### ConsoleChannel

ConsoleChannel(
std::ostream & str
);

Creates the channel using the given stream.

## Destructor

### ~ConsoleChannel

~ConsoleChannel() override;

## Member Functions

### log

void log(
const Message & msg
) override;

Logs the given message to the channel's stream.

See also: Poco::Channel::log()