Class Poco::FormattingChannel
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco

# class FormattingChannel

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

## Description

The FormattingChannel is a filter channel that routes a Message through a Formatter before passing it on to the destination channel.

## Inheritance

Direct Base Classes: Channel

All Base Classes: Channel, Configurable, RefCountedObject

## Member Summary

Member Functions: close, getChannel, getFormatter, log, open, setChannel, setFormatter, setProperty

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

## Constructors

### FormattingChannel

FormattingChannel();

Creates a FormattingChannel.

### FormattingChannel

FormattingChannel(
Formatter * pFormatter
);

Creates a FormattingChannel and attaches a Formatter.

### FormattingChannel

FormattingChannel(
Formatter * pFormatter,
Channel * pChannel
);

Creates a FormattingChannel and attaches a Formatter and a Channel.

## Destructor

### ~FormattingChannel

~FormattingChannel();

## Member Functions

### close

void close();

Closes the attached channel.

See also: Poco::Channel::close()

### getChannel

Channel * getChannel() const;

Returns the channel to which the formatted messages are passed on.

### getFormatter

Formatter * getFormatter() const;

Returns the Formatter used to format messages, which may be null.

### log

void log(
const Message & msg
);

Formats the given Message using the Formatter and passes the formatted message on to the destination Channel.

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

### open

void open();

Opens the attached channel.

See also: Poco::Channel::open()

### setChannel

void setChannel(
Channel * pChannel
);

Sets the destination channel to which the formatted messages are passed on.

### setFormatter

void setFormatter(
Formatter * pFormatter
);

Sets the Formatter used to format the messages before they are passed on. If null, the message is passed on unmodified.

### setProperty

void setProperty(
const std::string & name,
const std::string & value
);

Sets or changes a configuration property.

Only the "channel" and "formatter" properties are supported, which allow setting the target channel and formatter, respectively, via the LoggingRegistry. The "channel" and "formatter" properties are set-only.

Unsupported properties are passed to the attached Channel.

See also: Poco::Channel::setProperty()