class Poco::FormattingChannel

Overview

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

#include <FormattingChannel.h>

class FormattingChannel: public Poco::Channel
{
public:
    // construction

    FormattingChannel();
    FormattingChannel(Formatter* pFormatter);

    FormattingChannel(
        Formatter* pFormatter,
        Channel* pChannel
        );

    // methods

    void
    setFormatter(Formatter* pFormatter);

    Formatter*
    getFormatter() const;

    void
    setChannel(Channel* pChannel);

    Channel*
    getChannel() const;

    virtual
    void
    log(const Message& msg);

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

    virtual
    void
    open();

    virtual
    void
    close();
};

Inherited Members

public:
    // methods

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

    virtual
    std::string
    getProperty(const std::string& name) const = 0;

    void
    duplicate() const;

    void
    release() const;

    int
    referenceCount() const;

    virtual
    void
    open();

    virtual
    void
    close();

    virtual
    void
    log(const Message& msg) = 0;

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

    virtual
    std::string
    getProperty(const std::string& name) const;

Detailed Documentation

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

Construction

FormattingChannel()

Creates a FormattingChannel.

FormattingChannel(Formatter* pFormatter)

Creates a FormattingChannel and attaches a Formatter.

FormattingChannel(
    Formatter* pFormatter,
    Channel* pChannel
    )

Creates a FormattingChannel and attaches a Formatter and a Channel.

Methods

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.

Formatter*
getFormatter() const

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

void
setChannel(Channel* pChannel)

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

Channel*
getChannel() const

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

virtual
void
log(const Message& msg)

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

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.

virtual
void
open()

Opens the attached channel.

virtual
void
close()

Closes the attached channel.