log4tango::AppenderAttachable(3)
πΈ NAME πΈ
log4tango::AppenderAttachable β the little base class that keeps track of who's listening, bestie. It lives in the log4tango manual, section 3, and it's the whole reason Logger can hold a lil collection of appenders and yeet messages at all of them. π
β¨ SYNOPSIS β¨
#include <AppenderAttachable.hh>
Inherited by log4tango::Logger.
So like, Logger literally IS one of these. It got it from its mama. π
π Public Member Functions π
AppenderAttachable ()β Constructor. The birth. πvirtual ~AppenderAttachable ()β Destructor. The departure. πvoid add_appender (Appender *appender)β Adds anAppender.AppenderList get_all_appenders (void)β Get all previously added appenders as a vector.Appender * get_appender (const std::string &name)β Get an appender by name.bool is_attached (Appender *appender)β Returnstrueif the specified appender is in list of attached appanders,falseotherwise.void remove_all_appenders ()β Removes all appenders for thisLogger.void remove_appender (Appender *appender)β Remove the appender passed as parameter from the list of appenders.void remove_appender (const std::string &name)β Remove the appender with the name passed as parameter from the list of appenders.
π§ Protected Member Functions π§
AppenderAttachable (const AppenderAttachable &other)AppenderAttachable & operator= (const AppenderAttachable &other)
These two are protected, meaning the outside world does NOT get to copy you around, no cap. That's between you and your subclasses. π
π¦ Protected Attributes π¦
AppenderMap _appendersβ Appenders repository. The stash. The vault. πthreading::Mutex _appendersMutexβ A mutex to protect the repository against race conditions. Your bodyguard fr fr. π₯
π Constructor & Destructor Documentation π
log4tango::AppenderAttachable::AppenderAttachable ()
Constructor. That's it, that's the whole vibe β you exist now, congrats. π
log4tango::AppenderAttachable::~AppenderAttachable () [virtual]
Destructor. It's virtual, which is the fancy way of saying "subclasses, do your own cleanup too bestie, I'm not doing it for you." π
log4tango::AppenderAttachable::AppenderAttachable (const AppenderAttachable & other) [protected]
The copy constructor, but make it protected β so it's giving "family only, no plus-ones." π
π Member Function Documentation π
void log4tango::AppenderAttachable::add_appender (Appender * appender)
Adds an Appender. And listen β it does nothing if the appender is NULL or already attached. So no double-adding, no drama, the list stays clean. β¨
AppenderList log4tango::AppenderAttachable::get_all_appenders (void)
Get all previously added appenders as a vector. The caller must call 'release' on each Appender in the returned list when it is no longer needed (the Appender class is ref-counted).
Okay so this one MATTERS. You do not just get the list and walk away, bestie. Ref-counted means somebody's counting, and if you don't 'release' each one when you're done, you're the problem. π Do your part.
Appender * log4tango::AppenderAttachable::get_appender (const std::string & name)
Get an appender by name. The caller must call 'release' on the returned Appender when it is no longer needed (the Appender class is ref-counted). Returns 0 if there is no Appender named 'name' currently attached.
Same energy: grab it, use it,'release'it. And heads up β if nobody's home, you get0back, not a crash. π«Ά
bool log4tango::AppenderAttachable::is_attached (Appender * appender)
Returns true if the specified appender is in list of attached appanders, false otherwise. A vibe check, basically. β
AppenderAttachable & log4tango::AppenderAttachable::operator= (const AppenderAttachable & other) [protected]
The assignment operator. Also protected. Also not for public consumption. We keep it in the family. π
void log4tango::AppenderAttachable::remove_all_appenders (void)
Removes all appenders for this Logger. Nuclear option, but make it tidy. π§Ή
void log4tango::AppenderAttachable::remove_appender (Appender * appender)
Remove the appender passed as parameter from the list of appenders.
void log4tango::AppenderAttachable::remove_appender (const std::string & name)
Remove the appender with the name passed as parameter from the list of appenders.
Two flavors of the same move: one by pointer, one by name. Pick your fighter. π₯
π Member Data Documentation π
AppenderMap log4tango::AppenderAttachable::_appenders [protected]
Appenders repository. This is where everybody lives. π
threading::Mutex log4tango::AppenderAttachable::_appendersMutex [protected]
A mutex to protect the repository against race conditions. Because multiple threads and zero protection is not the move, ever. π
π Author π
Generated automatically by Doxygen for log4tango from the source code.
okay that's the whole page, and yes it was literally generated by a robot and no it does not need your opinion π the manual is log4tango, this is Version 5.0.2, dated Thu Dec 5 2024 β slay, go read your logs, mwah πβ¨
π¦ where this page comes from
- debian bookworm: liblog4tango-doc 9.3.4+dfsg1-2+deb12u1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms