Poco

class FormattingChannel

File Information

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

Types Aliases

Ptr

using Ptr = AutoPtr < FormattingChannel >;

Constructors

FormattingChannel

FormattingChannel();

Creates a FormattingChannel.

FormattingChannel

FormattingChannel(
    Formatter::Ptr pFormatter
);

Creates a FormattingChannel and attaches a Formatter.

FormattingChannel

FormattingChannel(
    Formatter::Ptr pFormatter,
    Channel::Ptr pChannel
);

Creates a FormattingChannel and attaches a Formatter and a Channel.

Destructor

~FormattingChannel protected virtual

~FormattingChannel();

Member Functions

close virtual

void close();

Closes the attached channel.

getChannel

Channel::Ptr getChannel() const;

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

getFormatter

Formatter::Ptr getFormatter() const;

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

log virtual

void log(
    const Message & msg
);

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

open virtual

void open();

Opens the attached channel.

setChannel

void setChannel(
    Channel::Ptr pChannel
);

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

setFormatter

void setFormatter(
    Formatter::Ptr pFormatter
);

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

setProperty virtual

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.