FBB::LogBuf(3bobcat)
π FBB::LogBuf π β the std::streambuf that handles your log messages
okay so real talk bestie, this is page 3bobcat, and it's all about FBB::LogBuf, a lil class that handles log messages like an absolute queen. let's get into it π
β¨ NAME β¨
FBB::LogBuf β a std::streambuf handling log messages π«Ά
β¨ SYNOPSIS β¨
#include <bobcat/logbuf>
Linking option: -lbobcat
β¨ DESCRIPTION β¨
so FBB::LogBuf is a class derived from std::streambuf that handles log messages. the stream you log to, the timestamps, and the log-levels β all of that can be configured at construction time and beyond, like it's literally never too late to change your mind π¦. and the way that FBB::LogBuf can be used to initialize a std::ostream? iconic. main character energy fr fr.
β¨ NAMESPACE β¨
FBB
bestie, every single constructor, member, operator and manipulator mentioned in this man-page is defined in the namespace FBB. no cap.
β¨ INHERITS FROM β¨
std::streambuf
β¨ ENUMERATIONS β¨
the TimeStamps enum πΈ
The enumeration TimeStamps is defined in the namespace FBB and it's there for you to use when initializing FBB::LogBuf objects. it has these values:
NOTIMESTAMPSβ log-messages will not have timestamps prepended to them. zero timestamps, none, nada πTIMESTAMPSβ log-messages will have timestamps prepended to them βUTCTIMESTAMPSβ log-messages will have timestamps showing the UTC time prepended to them π
the Active enum π
The enumeration Active is used to distinguish between two whole moods: suspending message insertion when a message's level does not exceed a minimum level, versus suspending all message insertions (e.g., when suspending inserting messages into FBB::Log objects after calling their off member). it's giving β¨boundariesβ¨:
OFFβ all insertions into theLogBufobject are suspended π;NOT_ACTIVEβ insertions of messages into theLogBufobject are suspended if their levels are less than the a specified minimum (as set by, e.g.,Log::setLevel).ACTIVEβ messages are inserted π₯
β¨ CONSTRUCTORS β¨
LogBuf(TimeStamps timestamps = TIMESTAMPS, bool active = true, char const *delim = " ")β this constructor constructs anFBB::LogBufobject writing its log-messages tostd::cerr. If theactiveparameter is initialized tofalsethen no messages will be logged until the buffer's activity is switched on (seesetActive()below). The parameterdelimis inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a0-pointer may be specified. Whenstamps == FBB::NOTIMESTAMPSthendelimis 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/logfiles. E.g.,Aug 5 13:52:23;LogBuf(std::ostream &stream, TimeStamps timestamps = TIMESTAMPS, bool active = true, char const *delim = " ")β this constructor constructs anFBB::LogBufobject writing its log-messages to the stream used to initialize itsstreamparameter. If theactiveparameter is initialized tofalsethen no messages will be logged until the buffer's activity is switched on (seesetActive()below). The parameterdelimis inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a0-pointer may be specified. Whenstamps == FBB::NOTIMESTAMPSthendelimis 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/logfiles. E.g.,Aug 5 13:52:23.
not me about to break your heart but: copy and move constructors (and assignment operators) are not available. π«
β¨ PUBLIC MEMBER FUNCTIONS β¨
all members of std::streambuf are available, because FBB::LogBuf inherits from this class. you get the whole family π
bool active() constβ returnstrueif log-messages are currently processed;bool empty() constβ returnstrueif the object's buffer is currently empty (initially or after a newline character has been inserted);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. like, keep it alive bestie, that's on you π«Ά;void settimestamp(FBB::TimeStamps timestamps, char const *delim = " ")β the member function (de)activates time stamp prepending. Use the valueFBB::TIMESTAMPSto prepend time stamps,FBB::NOTIMESTAMPSsuppresses 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/logfiles. E.g.,Aug 5 13:52:23. The parameterdelimis inserted immediately beyond the time stamp. If a delimiter is inappropriate, an empty string or a0-pointer may be specified. Whenstamps == FBB::NOTIMESTAMPSthendelimis ignored;void setActive(bool active)β unless the current object'sActivestate isOFFthis member can be used to (de)activate logging. The argumenttrueactivates logging, the argumentfalsedeactivates it. If the currentActivestatus isOFFthen this member does not change the object's activity status. This member is normally called byFBB::Log::levelmembers;void setActive(Active active)β the member function (de)activates logging. The argumentACTIVEactivates logging, the argumentOFFcompletely suppresses logging, the argumentNOT_ACTIVEalso suppresses logging, but heresetActive(true)can also be used reactivate logging;void setEmpty(bool empty)β this member may be called to ensure that a timestamp is inserted before the next insertion. It is called assetEmpty(true)when a newline character (\n) is inserted, ensuring that another timestamp is prepended before the next insertion. π
β¨ EXAMPLE β¨
okay here's the whole vibe in code, copy it exactly bestie:
#include <iostream>
#include <iomanip>
#include <bobcat/log>
#include <bobcat/level>
using namespace std;
using namespace FBB;
int main()
{
LogBuf buffer(cout, FBB::TIMESTAMPS);
ostream log(&buffer);
log << "This message is written to cout" << nl <<
setw(16) << β β << "occupying multiple lines\n";
buffer.setActive(false);
log << "one line\n";
log << "more lines ";
log << fnl;
log << "another\n";
buffer.setActive(true);
log << "and active again\n";
log << "another log msg\n";
}
β¨ FILES β¨
bobcat/logbufβ defines the class interface π¦
β¨ SEE ALSO β¨
β¨ BUGS β¨
None Reported. β¨ (we love a clean bill of health)
β¨ BOBCAT PROJECT FILES β¨
https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
β¨ BOBCAT β¨
Bobcat is an acronym of Brokken's Own Base Classes And Templates. iykyk π
β¨ 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).
and that's the whole page bestie, slay π
thanks for reading, mwah π«Ά this was libbobcat-dev_6.15.01, dated 2005-2026, and yes she's been serving since 2005, periodt π
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms