FBB::SyslogBuf(3bobcat)

Stream Buffer for Syslog
(libbobcat-dev_6.04.00)

2005-2023

NAME

FBB::SyslogBuf - A streambuf object inserting syslog messages

SYNOPSIS

#include <bobcat/syslogbuf>
Linking option: -lbobcat

DESCRIPTION

Addresses of FBB::SyslogBuf objects can be passed as std::streambuf addresses to std::ostream objects to write messages to the syslog daemon using stream facilities.

Multiple separate insertions can be used to create a single syslog message: the message is only sent to the syslog daemon after receiving a flush command (e.g., after inserting std::flush or std::endl). Non-printable characters (like '\n') show up in the syslog message as octal values, preceded by # (e.g., #012 for '\n'). The newline normally inserted by std::endl is ignored: SyslogStream objects interpret std::endl like std::flush.

One series of insertions may contain multiple std::endl or std::flush manipulators. At each of these manipulators a new message is sent to the syslog daemon, containing all info that has so far been buffered. After sending a message to the syslog daemon, the SyslogStream's internal buffer is cleared.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

FBB::EoiBuf and thus from std::streambuf

ENUMERATIONS

The following enumerations are defined in the namespace FBB:

Priority:

The values of this enumeration match the corresponding priority LOG_xxx values used with syslog(3):

PriorityType:

This enumeration has two values fine-tuning the type of messages that are actually processed by the syslog daemon:

By default, the syslog daemon processes all messages it receives.

Facility:

The values of this enumeration match the corresponding facility LOG_xxx values used with syslog(3):

CONSTRUCTOR

Copy and move constructors (and assignment operators) are not available.

MEMBER FUNCTIONS

All members of std::streambuf are available, as FBB::SyslogBuf inherits from this class.

MANIPULATOR

EXAMPLE

See also syslogstream(3bobcat)


#include <iostream>
#include <bobcat/syslogstream>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
{
    ostream sls(new SyslogBuf(argv[0]));

    sls << SyslogStream::debug << "Hello world" << flush <<
           SyslogStream::strerrno << endl;
}
    

FILES

bobcat/syslogbuf - defines the class interface

SEE ALSO

bobcat(7), closelog(3), openlog(3), rsyslogd(8) syslog(3), syslogstream(3bobcat)

BUGS

The constructor's option parameter is an int. Because of this, int values rather than enumeration values are passed to the constructor. It is the responsibility of the programmer to pass defined option values only.

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).