includefile(include/header)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::LogBuffer)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_-x.tar.gz)
                    (log messages stream buffer)

manpagename(FBB::LogBuffer)( bf(std::streambuf) handling log messages)

manpagesynopsis()
    bf(#include <bobcat/logbuffer>)nl()
    Linking option: tt(-lbobcat) 

manpagedescription()

    bf(FBB::LogBuffer) is a class derived from bf(std::streambuf) handling log
messages. The stream to log to, timestamps and log-levels can be configured
both at construction time and beyond. The bf(FBB::LogBuffer) may be used to
initialize a bf(std::ostream). 

includefile(include/namespace)

manpagesection(INHERITS FROM)
    bf(std::streambuf)

manpagesection(ENUMERATION)
    The enumeration bf(TimeStamps) is defined in the namespace bf(FBB) to be
used when initializing bf(FBB::LogBuffer) objects. It has the following
values:
    itemization(
    itb(NOTIMESTAMPS)
        Log-messages will not have timestamps prepended to them.
    itb(TIMESTAMPS)
        Log-messages will have timestamps prepended to them.
    itb(UTCTIMESTAMPS)
        Log-messages will have timestamps showing the UTC time prepended to
        them.
    )

manpagesection(CONSTRUCTORS)
    itemization(
    itb(LogBuffer(TimeStamps timestamps = TIMESTAMPS,
                bool active = true,
                char const *delim = " "))
        This constructor constructs an bf(FBB::LogBuffer) object writing its
log-messages to bf(std::cerr). If the bf(active) parameter is initialized to
bf(false) no messages will be logged until the buffer's activity is switched
on (see bf(setActive()) below).  The parameter bf(delim) is inserted
immediately beyond the time stamp. If a delimiter is inappropriate, an empty
string or a 0-pointer may be specified. When bf(stamps == FBB::NOTIMESTAMPS
delim) is ignored. A time stamp consists of the month, the day number of the
month and the (local) time of the current message, as usually appearing in
messages in tt(/var/log) files. E.g., tt(Aug 5 13:52:23).
        itb(LogBuffer(std::ostream &stream, 
                TimeStamps timestamps = TIMESTAMPS,
                bool active = true,
                char const *delim = " "))
        This constructor constructs an bf(FBB::LogBuffer) object writing its
log-messages to the stream used to initialize its bf(stream) parameter. If the
bf(active) parameter is initialized to bf(false) no messages will be logged
until the buffer's activity is switched on (see bf(setActive()) below). The
parameter bf(delim) is inserted immediately beyond the time stamp. If a
delimiter is inappropriate, an empty string or a 0-pointer may be
specified. When bf(stamps == FBB::NOTIMESTAMPS delim) is ignored. A time stamp
consists of the month, the day number of the month and the (local) time of the
current message, as usually appearing in messages in tt(/var/log) files. E.g.,
tt(Aug 5 13:52:23).
    )

    Copy and move constructors are not available.

manpagesection(MEMBER FUNCTIONS)
     All members of bf(std::streambuf) are available, as bf(FBB::LogBuffer)
inherits from this class. 
    itemization(
    itb(int overflow(int c))
    This member em(overrides) the bf(std::streambuf) member. It is
called by tt(std::ostream) objects using bf(OFdStreambuf). It calls
tt(sync()), an then it puts the next available character into the buffer. It
returns the inserted character.
    itb(void setActive(bool active))
        The member function (de)activates logging. The argument bf(true)
activates logging, the argument bf(false) deactivates it.
    itb(void setStream(std::ostream &stream))
        This member may be used to switch the stream to log to. It is the
responsibility of the programmer to ensure that the external stream remains
available for as long as log-messages are inserted into it.
    itb(void settimestamp(FBB::TimeStamps timestamps,
                char const *delim = " "))
        The member function (de)activates time stamp prepending. Use the value
bf(FBB::TIMESTAMPS) to prepend time stamps, bf(FBB::NOTIMESTAMPS) suppresses
time stamps.   A time stamp consists of the month, the day number of the month
and the (local) time of the current message, as usually appearing in messages
in tt(/var/log) files. E.g., tt(Aug 5 13:52:23). The parameter bf(delim) is
inserted immediately beyond the time stamp. If a delimiter is inappropriate,
an empty string or a 0-pointer may be specified. When bf(stamps ==
FBB::NOTIMESTAMPS delim) is ignored.
    itb(void setEmpty(bool empty))
        This member may be called to ensure that a timestamp is inserted
before the next insertion. It is called as bf(setEmpty(true)) when a newline
character (tt(\n)) is inserted, ensuring that another timestamp is prepended
before the next insertion.
    itb(int sync())
        This member em(overrides) the bf(std::streambuf) member. It writes
the buffer to the device associated with the file descriptor, and returns 0.
    )

manpagesection(PROTECTED MEMBER FUNCTION)

    The member listed in this section implements the tasks of the comparably
named virtual function in the class's private interface. This separates the
redefinable interface from the user-interface. The class bf(LogBuffer)
can, in accordance with Liskov's Substitution Principle, be used as a
tt(std:streambuf); but it also offers a facility for classes deriving from
bf(LogBuffer). This facility is listed here.
    itemization(
    itb(int pSync())
        The contents of the bf(LogBuffer)'s internal buffer is flushed.
    )


manpagesection(EXAMPLE)
    verbinclude(../../logbuffer/driver/driver.cc)

manpagefiles()
    em(bobcat/logbuffer) - defines the class interface

manpageseealso()
    bf(bobcat)(7), bf(log)(3bobcat)

manpagebugs()
    None Reported.

includefile(include/trailer)
