FBB::SyslogStream(3bobcat)
π¦ FBB::SyslogStream β the syslog output stream, bestie edition π
okay so picture this: you're in FBB::SyslogStream(3bobcat) territory, and it's literally the cutest way to talk to syslog. Let's get into it, no cap.
β¨ NAME β¨
FBB::SyslogStream β an output stream that inserts syslog messages πΈ
β¨ SYNOPSIS β¨
#include <bobcat/syslogstream>
Linking option: -lbobcat
β¨ DESCRIPTION β¨
FBB::SyslogStream objects can be used just like a std::ostream, except they write syslog messages using all the stream facilities you already know and love. iconic behavior, honestly π«Ά
You can stack up multiple separate insertions to build one single syslog message β the message only actually heads to the syslog daemon once it gets a flush command (so like, after you insert std::flush or std::endl).
Non-printable characters (think '\n') show up in the syslog message as octal values, preceded by # β so for example #012 is what '\n' turns into. And here's the tea: the newline that std::endl would normally insert gets ignored. SyslogStream objects treat std::endl exactly like std::flush. π
One series of insertions can hold multiple std::endl or std::flush manipulators, and at each one a whole new message gets sent to the syslog daemon containing everything buffered so far. Once a message is sent, the SyslogStream's internal buffer is cleared. clean slate energy β¨
β¨ NAMESPACE β¨
FBB
Every constructor, member, operator and manipulator mentioned in this man-page lives in the namespace FBB. π
β¨ INHERITS FROM β¨
std::ostream
β¨ ENUMERATIONS β¨
These enumerations are defined in the namespace FBB:
π Priority
These values match up with the corresponding priority LOG_xxx values used with syslog(3):
EMERGβ system is unusable;ALERTβ action must be taken immediately;CRITβ critical conditions;ERRβ error conditions;WARNINGβ warning conditions;NOTICEβ normal, but significant, condition;INFOβ informational message;DEBUGβ debug-level message; thesetMaskmember (peep below π) can be used to select which type of messages will actually be processed by the syslog daemon.
π PriorityType
This enumeration has two values that fine-tune which type of messages actually get processed by the syslog daemon:
SINGLEβ only messages of the priority specified at thesetMaskcall are processed by the syslog daemon;UPTOβ messages of priorityEMERGup to the priority specified at thesetMaskcall are processed by the syslog daemon; by default, the syslog daemon processes all messages it receives.
π Facility
These values match up with the corresponding facility LOG_xxx values used with syslog(3):
AUTHPRIVβ security/authorization messages (private)CRONβ clock daemon (cron and at)DAEMONβ other system daemonsKERNβ kernel messagesLOCAL0β reserved for local use.LOCAL1throughLOCAL7are available as well.LPRβ line printer subsystemMAILβ mail subsystemNEWSβ USENET news subsystemSYSLOGBUFβ messages generated internally bysyslogbufdUSERβ generic user-level messagesUUCPβ UUCP subsystem
β¨ CONSTRUCTORS β¨
SyslogStream(string const &ident = "", FBB::Priority priority = FBB::NOTICE, FBB::Facility facility = FBB::USER, int option = 0)β this constructor initializes aSyslogStreamobject. π Theidentparameter is usually the name of the program, and its content gets prepended to syslog messages.
The priority parameter decides the default importance of the message sent to the syslog daemon. By default messages go to the syslog daemon with priority FBB::NOTICE. Syslog messages can be given a different priority by inserting a SyslogStream manipulator (see below). The priority set at construction time can also be changed using the setPriority and setDefaultPriority members.
Which messages actually show up in log facilities is not decided by the messages' priorities, but by syslog's log mask. The log mask can be set by the static member setMask (see below).
The facility parameter decides the type of program doing the logging. By default FBB::USER is used.
The option parameter can be used to specify various options (use the binary bitor (|) operator to combine them):
LOG_CONS: write directly to system console if there is an error while sending to system loggerLOG_NDELAY: open the connection immediately (normally, the connection is opened when the first message is logged)LOG_PERROR: print to stderr as wellLOG__PID: include PID with each message
By default no options are used. β¨
Copy and move constructors (and assignment operators) are not available. sorry bestie, they're just not invited to the party π
β¨ MEMBER FUNCTIONS β¨
All members of std::ostream are available, since FBB::SyslogStream inherits from this class. π
void close()β if theSyslogStream's internal buffer isn't empty, it gets flushed to the syslog daemon. After that,closelog(3)is called.Priority defaultPriority() constβ returns the current default priority. Like, the priority that'll be used for messages after insertingendlorflush.void open(string const &ident, FBB::Priority priority = FBB::NOTICE, FBB::Facility facility = FBB::USER, int option = 0)β redefines the current identifier, priority, facility and options used when sending messages to the syslog daemon. If theSyslogStream's internal buffer isn't empty, it's first flushed to the syslog daemon using the identifier, priority and options that were active just before callingopen.Priority priority() constβ returns the next priority. i.e., the priority that'll be used for the next message sent to the syslog daemon.Priority setDefaultPriority(Priority priority)β changes the default priority of the next message sent to the syslog daemon after insertingstd::eolnorstd::flush. The previously active default priority is returned. πPriority setPriority(Priority priority)β changes the priority for the next message sent to the syslog daemon after insertingstd::eolnorstd::flush. Subsequent messages will go back to using the default priority. The previously active priority setting is returned.
β¨ STATIC MEMBER FUNCTIONS β¨
Priority setMask(Priority priority, PriorityMask upTo)β syslog messages of (ifupToequalsSINGLE) or up to (ifupToequalsUPTO) the indicated priority are processed by the syslog daemon.Priority setMask(Priority priority, Priority ...priorities)β syslog messages of the priorities passed tosetMaskare processed by the syslog daemon. At least one priority must be specified. πFacility stoF(std::string const &name, Facility facility = USER)β returns the facility matching the name of the facility provided byname. Facility matching happens case insensitively. so like, ifnamecontainsdaemon, facilityFBB::DAEMONis returned. Ifnamedoesn't match any facility name, then the value of this function's second argument is returned. The function's name (stoF) was chosen in analogy of the varioussto...conversion functions that the C++11 standard made available. πPriority stoP(std::string const &name, Priority priority = NOTICE)β returns the priority matching the name of the priority provided byname. Priority matching happens case insensitively. e.g., ifnamecontainsemerg, priorityFBB::EMERGis returned. Ifnamedoesn't match any priority name, then the value of this function's second argument is returned. The function's name (stoP) was chosen in analogy of the varioussto...conversion functions that the C++11 standard made available. β¨
β¨ MANIPULATORS β¨
This next set of manipulators are all defined as (static) members. They can be inserted into an FBB::SyslogStream object. Except for the last manipulator (strerrno), they all share these characteristics in common:
- They change the priority of the messages that are subsequently inserted by the
FBB::SyslogStreamobject β so they act like a separatesetPrioritycall. - When you insert multiple manipulators before the inserted message is flushed (e.g., using
std::flushorstd::endl), the last insertedFBB::SyslogStreammanipulator will be used. - If the manipulators are inserted into something that isn't an
FBB::SyslogStreamobject (like some otherstd::ostreamtype of object), then they perform no action at all. π
Here are the available manipulators:
SyslogStream::alertβ messages are inserted with priorityFBB::ALERT.SyslogStream::critβ messages are inserted with priorityFBB::CRIT.SyslogStream::debugβ messages are inserted with priorityFBB::DEBUG.SyslogStream::emergβ messages are inserted with priorityFBB::EMERG.SyslogStream::errβ messages are inserted with priorityFBB::ERR.SyslogStream::infoβ messages are inserted with priorityFBB::INFO.SyslogStream::noticeβ messages are inserted with priorityFBB::NOTICE.SyslogStream::strerrnoβ this manipulator inserts the textual interpretation ofstd::errno's current value into astd::ostream. Heads up though: unlike the other manipulators, the object you insert this one into does not have to be anFBB::SyslogStreamobject. π¦SyslogStream::warningβ messages are inserted with priorityFBB::WARNING.
β¨ EXAMPLE β¨
#include <bobcat/syslogstream>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
SyslogStream sls(argv[0]);
sls << SyslogStream::debug << "Hello world" << flush <<
SyslogStream::strerrno << endl;
}
β¨ FILES β¨
bobcat/syslogstream β defines the class interface
β¨ SEE ALSO β¨
bobcat(7), closelog(3), log(3bobcat), openlog(3), rsyslogd(8), syslog(3), syslogbuf(3bobcat)
β¨ BUGS β¨
The constructor's option parameter is an int. Because of this, int values rather than enumeration values get passed to the constructor. So it's π― the responsibility of the programmer to pass defined option values only. no cap, be careful bestie π
π BOBCAT PROJECT FILES π
okay bestie, if you wanna go straight to the source (literally), here's where all the bobcat goodies live:
https://fbb-git.gitlab.io/bobcat/β the gitlab project page, your one-stop shop, the mothership, iykyk;- Debian Bobcat project files, aka the distro-specific lore:
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 π
fun fact time, because the name is lowkey a whole personality:
Bobcat is an acronym of `Brokkenβs Own Base Classes And Templatesβ.
likeβ¦ the audacity, the branding, the main character energy. obsessed. β¨
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL).
free as in freedom, and legally official, no cap. π«Ά
π¦ AUTHOR π¦
Frank B. Brokken (f.b.brokken@rug.nl).
the icon, the legend, the reason this whole thing exists. bow down. π
anyway bestie that's the whole page, you made it to the end and i'm so proud of you π this was libbobcat-dev_6.15.01, dated 2005-2026, and yes it's the real FBB::SyslogStream(3bobcat) manpage β go forth and log stuff responsibly, mwah π
πΈ
π¦ 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