class Poco::SyslogChannel

Overview

This Unix-only channel works with the Unix syslog service. More…

#include <SyslogChannel.h>

class SyslogChannel: public Poco::Channel
{
public:
    // enums

    enum Facility;
    enum Option;

    // fields

    static const std::string PROP_NAME;
    static const std::string PROP_FACILITY;
    static const std::string PROP_OPTIONS;

    // construction

    SyslogChannel();

    SyslogChannel(
        const std::string& name,
        int options = SYSLOG_CONS,
        int facility = SYSLOG_USER
        );

    // methods

    virtual
    void
    open();

    virtual
    void
    close();

    virtual
    void
    log(const Message& msg);

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

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

protected:
    // methods

    static
    int
    getPrio(const Message& msg);
};

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

This Unix-only channel works with the Unix syslog service.

Construction

SyslogChannel()

Creates a SyslogChannel.

SyslogChannel(
    const std::string& name,
    int options = SYSLOG_CONS,
    int facility = SYSLOG_USER
    )

Creates a SyslogChannel with the given name, options and facility.

Methods

virtual
void
open()

Opens the SyslogChannel.

virtual
void
close()

Closes the SyslogChannel.

virtual
void
log(const Message& msg)

Sens the message’s text to the syslog service.

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

Sets the property with the given value.

The following properties are supported:

* name:     The name used to identify the source of log messages.
* facility: The facility added to each log message. See the Facility enumeration for a list of supported values.
* options:  The logging options. See the Option enumeration for a list of supported values.
virtual
std::string
getProperty(const std::string& name) const

Returns the value of the property with the given name.