log4shib::...xtCategory(3)
π¦ log4shib::FixedContextCategory(3) β Library Functions Manual π¦
πΈ NAME πΈ
log4shib::FixedContextCategory β This Category subclass replaces the NDC field in LoggingEvents with a fixed context string.
β¨ SYNOPSIS β¨
#include <FixedContextCategory.hh>
Inherits log4shib::Category.
π Public Member Functions π
FixedContextCategory (const std::string &name, const std::string &context='')β Constructor.virtual ~FixedContextCategory ()β Destructor for Category.virtual void setContext (const std::string &context)β Set the context string used as NDC.virtual std::string getContext () constβ Return the context string used as NDC.virtual Priority::Value getPriority () const throw ()β Returns the assigned Priority, if any, for this Category.virtual Priority::Value getChainedPriority () const throw ()β Starting from this Category, search the category hierarchy for a set priority and return it.virtual void addAppender (Appender *appender) throw ()β For the moment this method does nothing.virtual void addAppender (Appender &appender)β For the moment this method does nothing.virtual Appender * getAppender () constβ Returns the Appender for this Category, orNULLif no Appender has been set.virtual Appender * getAppender (const std::string &name) constβ Returns the specified Appender for this Category, orNULLif the Appender is not attached to this Category.virtual AppenderSet getAllAppenders () constβ Returns the set of Appenders currently attached to this Category.virtual void removeAllAppenders ()β Removes all appenders set for this Category.virtual bool ownsAppender (Appender *appender) const throw ()β FixedContextAppenders cannot own Appenders.virtual void callAppenders (const LoggingEvent &event) throw ()β Call the appenders in the hierarchy starting at this.virtual void setAdditivity (bool additivity)β Set the additivity flag for this Category instance.virtual bool getAdditivity () const throw ()β Returns the additivity flag for this Category instance.
π«Ά Public Member Functions inherited from log4shib::Category π«Ά
virtual ~Category ()β Destructor for Category.virtual const std::string & getName () const throw ()β Return the category name.virtual void setPriority (Priority::Value priority)β Set the priority of this Category.virtual bool isPriorityEnabled (Priority::Value priority) const throw ()β Returns true if the chained priority of the Category is equal to or higher than given priority.void setAppender (Appender *appender)β Adds an Appender to this Category.void setAppender (Appender &appender)β Adds an Appender for this Category.virtual void removeAppender (Appender *appender)β Removes specified appender for this Category.bool ownsAppender () const throw ()β Returns true if the Category owns the first Appender in its Appender set.virtual Category * getParent () throw ()β Returns the parent category of this category, orNULLif the category is the root category.virtual const Category * getParent () const throw ()β Returns the parent category of this category, orNULLif the category is the root category.virtual void log (Priority::Value priority, const char *stringFormat,...) throw ()β Log a message with the specified priority.virtual void log (Priority::Value priority, const std::string &message) throw ()β Log a message with the specified priority.virtual void logva (Priority::Value priority, const char *stringFormat, va_list va) throw ()β Log a message with the specified priority.void debug (const char *stringFormat,...) throw ()β Log a message with debug priority.void debug (const std::string &message) throw ()β Log a message with debug priority.bool isDebugEnabled () const throw ()β Return true if the Category will log messages with priority DEBUG.CategoryStream debugStream ()β Return a CategoryStream with priority DEBUG.void info (const char *stringFormat,...) throw ()β Log a message with info priority.void info (const std::string &message) throw ()β Log a message with info priority.bool isInfoEnabled () const throw ()β Return true if the Category will log messages with priority INFO.CategoryStream infoStream ()β Return a CategoryStream with priority INFO.void notice (const char *stringFormat,...) throw ()β Log a message with notice priority.void notice (const std::string &message) throw ()β Log a message with notice priority.bool isNoticeEnabled () const throw ()β Return true if the Category will log messages with priority NOTICE.CategoryStream noticeStream ()β Return a CategoryStream with priority NOTICE.void warn (const char *stringFormat,...) throw ()β Log a message with warn priority.void warn (const std::string &message) throw ()β Log a message with warn priority.bool isWarnEnabled () const throw ()β Return true if the Category will log messages with priority WARN.CategoryStream warnStream ()β Return a CategoryStream with priority WARN.void error (const char *stringFormat,...) throw ()β Log a message with error priority.void error (const std::string &message) throw ()β Log a message with error priority.bool isErrorEnabled () const throw ()β Return true if the Category will log messages with priority ERROR.CategoryStream errorStream ()β Return a CategoryStream with priority ERROR.void crit (const char *stringFormat,...) throw ()β Log a message with crit priority.void crit (const std::string &message) throw ()β Log a message with crit priority.bool isCritEnabled () const throw ()β Return true if the Category will log messages with priority CRIT.CategoryStream critStream ()β Return a CategoryStream with priority CRIT.void alert (const char *stringFormat,...) throw ()β Log a message with alert priority.void alert (const std::string &message) throw ()β Log a message with alert priority.bool isAlertEnabled () const throw ()β Return true if the Category will log messages with priority ALERT.CategoryStream alertStream () throw ()β Return a CategoryStream with priority ALERT.void emerg (const char *stringFormat,...) throw ()β Log a message with emerg priority.void emerg (const std::string &message) throw ()β Log a message with emerg priority.bool isEmergEnabled () const throw ()β Return true if the Category will log messages with priority EMERG.CategoryStream emergStream ()β Return a CategoryStream with priority EMERG.void fatal (const char *stringFormat,...) throw ()β Log a message with fatal priority.void fatal (const std::string &message) throw ()β Log a message with fatal priority.bool isFatalEnabled () const throw ()β Return true if the Category will log messages with priority FATAL.CategoryStream fatalStream ()β Return a CategoryStream with priority FATAL.virtual CategoryStream getStream (Priority::Value priority)β Return a CategoryStream with given Priority.virtual CategoryStream operator<< (Priority::Value priority)β Return a CategoryStream with given Priority.
π Protected Member Functions π
virtual void _logUnconditionally2 (Priority::Value priority, const std::string &message) throw ()β Unconditionally log a message with the specified priority.
π Protected Member Functions inherited from log4shib::Category π
Category (const std::string &name, Category *parent, Priority::Value priority=Priority::NOTSET)β Constructor.virtual void _logUnconditionally (Priority::Value priority, const char *format, va_list arguments) throw ()
π Additional Inherited Members π
Static Public Member Functions inherited from log4shib::Category
static Category & getRoot ()β Return the root of the Category hierarchy.static void setRootPriority (Priority::Value priority)β Set the priority of the root Category.static Priority::Value getRootPriority () throw ()β Get the priority of the root Category.static Category & getInstance (const std::string &name)β Instantiate a Category with name name.static Category * exists (const std::string &name)β If the named category exists (in the default hierarchy) then it returns a reference to the category, otherwise it returnsNULL.static std::vector< Category * > * getCurrentCategories ()β Returns all the currently defined categories as a vector of Category pointers.static void shutdown ()β This method will remove all Appenders from Categories.XXX.
π Detailed Description π
This Category subclass replaces the NDC field in LoggingEvents with a fixed context string.
All handling of Appenders, etc. is delegated to the 'normal' Category with the same name. Its intended use is for object instances that serve a single client: they construct a FixedContextCategory with the client identifier as context. Unlike with regular Category instances one has to explicitly create FixedContextCategory instances using the constructor.
β οΈ This also means you have to take care of destruction of the instance yourself. No cap β it's on you, bestie.
Since
0.2.4
π Constructor & Destructor Documentation π
π log4shib::FixedContextCategory::FixedContextCategory (const std::string &name, const std::string &context = '')
Constructor.
Parameters
- name β the fully qualified name of this Categoryβs delegate Category.
- context β the context to fill the NDC field of
LoggingEventswith.
π¦ log4shib::FixedContextCategory::~FixedContextCategory () [virtual]
Destructor for Category.
π MEMBER FUNCTION DOCUMENTATION π
π¦ _logUnconditionally2
void log4shib::FixedContextCategory::_logUnconditionally2 (Priority::Value priority, const std::string & message) [protected], [virtual]
Okay so this one is the no-vibe-check logger β it logs a message with the priority you hand it, unconditionally. No filtering, no "should I?", it just goes. Protected, so it's for the internals, and virtual, so it can be overridden.
Parameters, bestie:
- priority β the priority of this log message.
- message β string to write in the log file
Reimplemented from log4shib::Category.
πΈ addAppender (reference flavor)
void log4shib::FixedContextCategory::addAppender (Appender & appender) [virtual]
For the moment this method does nothing. Literally nothing. Iconic behavior honestly β it's giving "I'm booked and busy." π
Reimplemented from log4shib::Category.
π addAppender (pointer flavor)
void log4shib::FixedContextCategory::addAppender (Appender * appender) [virtual]
Same deal, pointer edition: for the moment this method does nothing. Yes, there are two of them and they both ghost you. π
Reimplemented from log4shib::Category.
π₯ callAppenders
void log4shib::FixedContextCategory::callAppenders (const LoggingEvent & event) [virtual]
This is the one that actually does the rounds: it calls the appenders in the hierarchy starting right at this. And if no appenders could be found at all? It emits a warning. Not silence β a warning. Important distinction, fr fr.
The way this works: it always calls all the appenders inherited from the hierarchy, circumventing any evaluation of whether to log or not to log that particular log request. No gatekeeping. Everyone gets the message. π
Parameters:
- event β the
LoggingEventto log.
Reimplemented from log4shib::Category.
β getAdditivity
bool log4shib::FixedContextCategory::getAdditivity () const [virtual]
Returns the additivity flag for this Category instance. That's it, that's the whole function. Short and correct. β¨
Reimplemented from log4shib::Category.
π¦ getAllAppenders
AppenderSet log4shib::FixedContextCategory::getAllAppenders () const [virtual]
Returns the set of appenders currently attached to this category. Since 0.3.1, so it's been holding it down for a while.
Returns: the set of attached appenders.
Reimplemented from log4shib::Category.
π getAppender (no args)
Appender * log4shib::FixedContextCategory::getAppender () const [virtual]
Returns the Appender for this Category, or NULL if no Appender has been set. So like β if you get NULL, nobody's home. π
Returns: the Appender.
Reimplemented from log4shib::Category.
π getAppender (by name)
Appender * log4shib::FixedContextCategory::getAppender (const std::string & name) const [virtual]
Same energy but you ask for a specific one by name. Returns the specified Appender for this Category, or NULL if that Appender is not attached to this Category.
Since 0.2.7 β she's been around.
Returns: the Appender.
Reimplemented from log4shib::Category.
πΈ getChainedPriority
Priority::Value log4shib::FixedContextCategory::getChainedPriority () const [virtual]
Okay so the logic here: starting from this Category, it searches the category hierarchy for a set priority and returns it. And if nobody up the chain has one set? Then it returns the priority of the root category. Someone's always gotta have an answer. π
And the glow-up detail: the Category class is designed so that this method executes as quickly as possible. Speed. Efficiency. Main character energy. β‘
Reimplemented from log4shib::Category.
π getContext
std::string log4shib::FixedContextCategory::getContext () const [virtual]
Returns the context string used as NDC. One job, does it well.
Returns: the context string.
π§ getPriority
Priority::Value log4shib::FixedContextCategory::getPriority () const [virtual]
Returns the assigned Priority for this Category, if any. And heads up β the value can be Priority::NOTSET, so don't assume it's always a real one. π
Returns: Priority β the assigned Priority, can be Priority::NOTSET.
Reimplemented from log4shib::Category.
π ownsAppender
bool log4shib::FixedContextCategory::ownsAppender (Appender * appender) const [virtual]
The lore here: FixedContextAppenders cannot own Appenders. So this returns false. Always. No cap, that's the answer.
Returns: false
Reimplemented from log4shib::Category.
πΊ removeAllAppenders
void log4shib::FixedContextCategory::removeAllAppenders () [virtual]
Removes all appenders set for this Category. And yes, currently a Category can have only one appender β but that may change in the future, so the "all" is aspirational. We love forward thinking. π«Ά
Reimplemented from log4shib::Category.
β setAdditivity
void log4shib::FixedContextCategory::setAdditivity (bool additivity) [virtual]
Sets the additivity flag for this Category instance. You give it the flag, it sets it. Simple, clean, slays. β¨
Reimplemented from log4shib::Category.
π setContext
void log4shib::FixedContextCategory::setContext (const std::string & context) [virtual]
Sets the context string that gets used as NDC.
Parameters:
- context β the context string
π AUTHOR π
Generated automatically by Doxygen for log4shib from the source code. Yes bestie, a robot wrote this page β we're just making it cute. π€π
and that's a wrap on the whole thing, mwah π β footer info for the road:log4shib, Version 2.0.1, pagelog4shib::...xtCategory(3). Go log something iconic. ππ
π¦ where this page comes from
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: liblog4shib-devel 2.0.1-160000.3.2 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms