LOG4CPP::FIXEDCONTEXTCATEGORY(3)
π log4cpp::FixedContextCategory(3) π
okay so bestie, this is a page from the Library Functions Manual β section 3, the C library / function-call girlies β and it's all about log4cpp::FixedContextCategory. grab a lil snack, we're getting into it π
πΈ NAME πΈ
log4cpp::FixedContextCategory β this Category subclass replaces the NDC field in LoggingEvents with a fixed context string. that's the whole vibe. no cap π
β¨ SYNOPSIS β¨
#include <FixedContextCategory.hh>
Inherits log4cpp::Category.
π Public Member Functions π
FixedContextCategory(const std::string &name, const std::string &context='')β Constructor. yes queen, build the thing π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 LOG4CPP_NOTHROWβ Returns the assigned Priority, if any, for this Category.virtual Priority::Value getChainedPriority() const LOG4CPP_NOTHROWβ Starting from this Category, search the category hierarchy for a set priority and return it.virtual void addAppender(Appender *appender) LOG4CPP_NOTHROWβ For the moment this method does nothing. π literally nothing, bestie, it's giving decorative.virtual void addAppender(Appender &appender)β For the moment this method does nothing. (same energy, reference edition π«Ά)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() const LOG4CPP_NOTHROWβ FixedContextAppenders cannot own Appenders. hard no, not their appenders βvirtual bool ownsAppender(Appender *appender) const LOG4CPP_NOTHROWβ FixedContextAppenders cannot own Appenders. still no πvirtual void callAppenders(const LoggingEvent &event) LOG4CPP_NOTHROWβ 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 LOG4CPP_NOTHROWβ Returns the additivity flag for this Category instance.
π Public Member Functions inherited from log4cpp::Category π
virtual ~Category()β Destructor for Category.virtual const std::string & getName() const LOG4CPP_NOTHROWβ Return the category name.virtual void setPriority(Priority::Value priority)β Set the priority of this Category.virtual bool isPriorityEnabled(Priority::Value priority) const LOG4CPP_NOTHROWβ Returnstrueif 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.virtual Category * getParent() LOG4CPP_NOTHROWβ Returns the parent category of this category, orNULLif the category is the root category.virtual const Category * getParent() const LOG4CPP_NOTHROWβ Returns the parent category of this category, orNULLif the category is the root category. (const version, she's the same but classier β¨)virtual void log(Priority::Value priority, const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with the specified priority.virtual void log(Priority::Value priority, const std::string &message) LOG4CPP_NOTHROWβ Log a message with the specified priority.virtual void logva(Priority::Value priority, const char *stringFormat, va_list va) LOG4CPP_NOTHROWβ Log a message with the specified priority.void debug(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with debug priority.void debug(const std::string &message) LOG4CPP_NOTHROWβ Log a message with debug priority.bool isDebugEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority DEBUG.CategoryStream debugStream()β Return aCategoryStreamwith priority DEBUG.void info(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with info priority.void info(const std::string &message) LOG4CPP_NOTHROWβ Log a message with info priority.bool isInfoEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority INFO.CategoryStream infoStream()β Return aCategoryStreamwith priority INFO.void notice(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with notice priority.void notice(const std::string &message) LOG4CPP_NOTHROWβ Log a message with notice priority.bool isNoticeEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority NOTICE.CategoryStream noticeStream()β Return aCategoryStreamwith priority NOTICE.void warn(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with warn priority.void warn(const std::string &message) LOG4CPP_NOTHROWβ Log a message with warn priority.bool isWarnEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority WARN.CategoryStream warnStream()β Return aCategoryStreamwith priority WARN.void error(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with error priority.void error(const std::string &message) LOG4CPP_NOTHROWβ Log a message with error priority.bool isErrorEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority ERROR.CategoryStream errorStream()β Return aCategoryStreamwith priority ERROR.void crit(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with crit priority.void crit(const std::string &message) LOG4CPP_NOTHROWβ Log a message with crit priority.bool isCritEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority CRIT.CategoryStream critStream()β Return aCategoryStreamwith priority CRIT.void alert(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with alert priority.void alert(const std::string &message) LOG4CPP_NOTHROWβ Log a message with alert priority.bool isAlertEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority ALERT.CategoryStream alertStream() LOG4CPP_NOTHROWβ Return aCategoryStreamwith priority ALERT.void emerg(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with emerg priority.void emerg(const std::string &message) LOG4CPP_NOTHROWβ Log a message with emerg priority.bool isEmergEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority EMERG.CategoryStream emergStream()β Return aCategoryStreamwith priority EMERG.void fatal(const char *stringFormat,...) LOG4CPP_NOTHROWβ Log a message with fatal priority.void fatal(const std::string &message) LOG4CPP_NOTHROWβ Log a message with fatal priority.bool isFatalEnabled() const LOG4CPP_NOTHROWβ Returntrueif the Category will log messages with priority FATAL.CategoryStream fatalStream()β Return aCategoryStreamwith priority FATAL.virtual CategoryStream getStream(Priority::Value priority)β Return aCategoryStreamwith given Priority.virtual CategoryStream operator<<(Priority::Value priority)β Return aCategoryStreamwith given Priority.
π¦ Protected Member Functions π¦
virtual void _logUnconditionally2(Priority::Value priority, const std::string &message) LOG4CPP_NOTHROWβ Unconditionally log a message with the specified priority. (no further comment in the source, icon behaviour honestly π)
π§ Protected Member Functions inherited from log4cpp::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) LOG4CPP_NOTHROWβ (no description on this one, it's a mystery, we respect the silence π)
π Additional Inherited Members π
β Static Public Member Functions inherited from log4cpp::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() LOG4CPP_NOTHROWβ 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 fromCategories.XXX.static void shutdownForced()β This method will remove all Appenders fromCategories.XXXand delete all appenders.
π₯ Detailed Description π₯
So like β this Category subclass replaces the NDC field in LoggingEvents with a fixed context string. that's the entire personality. π
All handling of Appenders, etc. is delegated to the 'normal' Category with the same name. lowkey the whole point: it's intended for object instances that serve a single client β they construct a FixedContextCategory with the client identifier as the context. and here's the catch, bestie, listen up: unlike with regular Category instances, you have to explicitly create FixedContextCategory instances using the constructor. which also means you have to take care of destruction of the instance yourself too. no free ride, no magic cleanup, it's giving main-character responsibility π«Ά
π fr fr: explicit construction + explicit destruction. don't come crying to me when you leak one.
π Since π
0.2.4 β vintage darling, she's been iconic since 0.2.4 β¨
π Constructor & Destructor Documentation π
log4cpp::FixedContextCategory::FixedContextCategory(const std::string &name, const std::string &context = '')
Constructor. π
Parameters
- name β the fully qualified name of this Categories delegate Category.
- context β the context to fill the NDC field of LoggingEvents with.
log4cpp::FixedContextCategory::~FixedContextCategory() [virtual]
Destructor for Category. say bye bestie ππ
π Member Function Documentation π
okay bestie, this is the whole member-function lineup, and yes, we're keeping every overload, flag, return value, and little note. no cap. π«Ά
void log4cpp::FixedContextCategory::_logUnconditionally2 (Priority::Value priority, const std::string & message) [protected], [virtual]β Unconditionally log a message with the specified priority.- Parameters:
priorityβ The priority of this log message.messageβ string to write in the log file
- Reimplemented from
log4cpp::Category.
- Parameters:
void log4cpp::FixedContextCategory::addAppender (Appender & appender) [virtual]β For the moment this method does nothing.- Reimplemented from
log4cpp::Category.
- Reimplemented from
void log4cpp::FixedContextCategory::addAppender (Appender * appender) [virtual]β For the moment this method does nothing.- Reimplemented from
log4cpp::Category.
- Reimplemented from
void log4cpp::FixedContextCategory::callAppenders (const LoggingEvent & event) [virtual]β Call the appenders in the hierarchy starting at this. If no appenders could be found, emit a warning.- This method always calls all the appenders inherited form the hierracy circumventing any evaluation of whether to log or not to log the particular log request.
- Parameters:
eventβ TheLoggingEventto log.
- Reimplemented from
log4cpp::Category.
bool log4cpp::FixedContextCategory::getAdditivity () const [virtual]β Returns the additivity flag for thisCategoryinstance.- Reimplemented from
log4cpp::Category.
- Reimplemented from
AppenderSet log4cpp::FixedContextCategory::getAllAppenders () const [virtual]β Returns the set ofAppenders currently attached to thisCatogory.- Since:
0.3.1 - Returns: The set of attached
Appenders. - Reimplemented from
log4cpp::Category.
- Since:
Appender * log4cpp::FixedContextCategory::getAppender () const [virtual]β Returns theAppenderfor thisCategory, orNULLif noAppenderhas been set.- Returns: The
Appender. - Reimplemented from
log4cpp::Category.
- Returns: The
Appender * log4cpp::FixedContextCategory::getAppender (const std::string & name) const [virtual]β Returns the specifiedAppenderfor thisCategory, orNULLif theAppenderis not attached to thisCategory.- Since:
0.2.7 - Returns: The
Appender. - Reimplemented from
log4cpp::Category.
- Since:
Priority::Value log4cpp::FixedContextCategory::getChainedPriority () const [virtual]β Starting from thisCategory, search the category hierarchy for a set priority and return it. Otherwise, return the priority of the root category.- The
Categoryclass is designed so that this method executes as quickly as possible. - Reimplemented from
log4cpp::Category.
- The
std::string log4cpp::FixedContextCategory::getContext () const [virtual]β Return the context string used as NDC.- Returns: the context string.
Priority::Value log4cpp::FixedContextCategory::getPriority () const [virtual]β Returns the assignedPriority, if any, for thisCategory.- Returns:
Priorityβ the assignedPriority, can bePriority::NOTSET - Reimplemented from
log4cpp::Category.
- Returns:
bool log4cpp::FixedContextCategory::ownsAppender () const [virtual]βFixedContextAppenders cannot ownAppenders.- Returns:
false - Reimplemented from
log4cpp::Category.
- Returns:
bool log4cpp::FixedContextCategory::ownsAppender (Appender * appender) const [virtual]βFixedContextAppenders cannot ownAppenders.- Returns:
false - Reimplemented from
log4cpp::Category.
- Returns:
void log4cpp::FixedContextCategory::removeAllAppenders () [virtual]β Removes all appenders set for thisCategory. Currently aCategorycan have only one appender, but this may change in the future.- Reimplemented from
log4cpp::Category.
- Reimplemented from
void log4cpp::FixedContextCategory::setAdditivity (bool additivity) [virtual]β Set the additivity flag for thisCategoryinstance.- Reimplemented from
log4cpp::Category.
- Reimplemented from
void log4cpp::FixedContextCategory::setContext (const std::string & context) [virtual]β Set the context string used as NDC.- Parameters:
contextβ the context string
- Parameters:
β¨ Author β¨
Generated automatically by Doxygen for log4cpp from the source code.
and that's the whole member-function vibe check, bestie π the source/version on this one is log4cpp Version 1.1, auto-generated by Doxygen, and there's no date on the footer so I'm not gonna invent one β periodt πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: log4cpp-devel 1.1.4-bp160.1.12 Β· LGPL-2.1-only
- opensuse-leap 16.0: log4cpp-devel 1.1.4-bp160.1.12 Β· LGPL-2.1-only
- opensuse-leap 16.0: log4cpp-devel 1.1.4-bp160.1.12 Β· LGPL-2.1-only
- opensuse-leap 16.0: log4cpp-devel 1.1.4-bp160.1.12 Β· 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