GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  LOGBUFFER (3)

NAME

FBB::LogBuffer - std::streambuf handling log messages

CONTENTS

SYNOPSIS

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

DESCRIPTION

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

NAMESPACE

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

INHERITS FROM

std::streambuf

ENUMERATION

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

CONSTRUCTORS

o LogBuffer(TimeStamps timestamps = TIMESTAMPS, bool active = true, char const *delim = \(dq \(dq):
This constructor constructs an FBB::LogBuffer object writing its log-messages to std::cerr. If the active parameter is initialized to false no messages will be logged until the buffer\(cqs activity is switched on (see setActive() below). The parameter delim is inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a 0-pointer may be specified. When 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 /var/log files. E.g., Aug 5 13:52:23.
o LogBuffer(std::ostream &stream, TimeStamps timestamps = TIMESTAMPS, bool active = true, char const *delim = \(dq \(dq):
This constructor constructs an FBB::LogBuffer object writing its log-messages to the stream used to initialize its stream parameter. If the active parameter is initialized to false no messages will be logged until the buffer\(cqs activity is switched on (see setActive() below). The parameter delim is inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a 0-pointer may be specified. When 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 /var/log files. E.g., Aug 5 13:52:23.

Copy and move constructors are not available.

MEMBER FUNCTIONS

All members of std::streambuf are available, as FBB::LogBuffer inherits from this class.
o int overflow(int c):
This member overrides the std::streambuf member. It is called by std::ostream objects using OFdStreambuf. It calls sync(), an then it puts the next available character into the buffer. It returns the inserted character.
o void setActive(bool active):
The member function (de)activates logging. The argument true activates logging, the argument false deactivates it.
o 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.
o void settimestamp(FBB::TimeStamps timestamps, char const *delim = \(dq \(dq):
The member function (de)activates time stamp prepending. Use the value FBB::TIMESTAMPS to prepend time stamps, 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 /var/log files. E.g., Aug 5 13:52:23. The parameter delim is inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a 0-pointer may be specified. When stamps == FBB::NOTIMESTAMPS delim is ignored.
o void setEmpty(bool empty):
This member may be called to ensure that a timestamp is inserted before the next insertion. It is called as setEmpty(true) when a newline character (\n) is inserted, ensuring that another timestamp is prepended before the next insertion.
o int sync():
This member overrides the std::streambuf member. It writes the buffer to the device associated with the file descriptor, and returns 0.

PROTECTED MEMBER FUNCTION

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

EXAMPLE

#include <iostream>
#include <iomanip>

#include <bobcat/log>

using namespace std; using namespace FBB;

int main() { LogBuffer buffer(cout, FBB::TIMESTAMPS); ostream log(&buffer);

log << \(dqThis message is written to cout\(dq << nl << setw(16) << \(cq \(cq << \(dqoccupying multiple lines\n\(dq; }

FILES

bobcat/logbuffer - defines the class interface

SEE ALSO

bobcat(7), log(3bobcat)

BUGS

None Reported.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

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).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::LOGBUFFER (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.