class Poco::LogStreamBuf

Overview

This class implements a streambuf interface to a Logger. Moreā€¦

#include <LogStream.h>

class LogStreamBuf: public Poco::BasicUnbufferedStreamBuf
{
public:
    // construction

    LogStreamBuf(
        Logger& logger,
        Message::Priority priority
        );

    // methods

    void
    setPriority(Message::Priority priority);

    Message::Priority
    getPriority() const;

    Logger&
    logger() const;
};

Inherited Members

public:
    // methods

    virtual
    int_type
    overflow(int_type c);

    virtual
    int_type
    underflow();

    virtual
    int_type
    uflow();

    virtual
    int_type
    pbackfail(int_type c);

    virtual
    std::streamsize
    xsgetn(
        char_type* p,
        std::streamsize count
        );

protected:
    // typedefs

    typedef std::basic_streambuf<ch, tr> Base;
    typedef std::basic_ios<ch, tr> IOS;
    typedef ch char_type;
    typedef tr char_traits;
    typedef Base::int_type int_type;
    typedef Base::pos_type pos_type;
    typedef Base::off_type off_type;
    typedef IOS::openmode openmode;

    // methods

    static
    int_type
    charToInt(char_type c);

Detailed Documentation

This class implements a streambuf interface to a Logger.

The streambuf appends all characters written to it to a string. As soon as a CR or LF (std::endl) is written, the string is sent to the Logger, with the set priority.

Construction

LogStreamBuf(
    Logger& logger,
    Message::Priority priority
    )

Creates the LogStream.

Methods

void
setPriority(Message::Priority priority)

Sets the priority for log messages.

Message::Priority
getPriority() const

Returns the priority for log messages.

Logger&
logger() const

Returns a reference to the Logger.