Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
Category Class Reference

#include <Category.hh>

Inheritance diagram for Category:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void addAppender (Appender *appender)
virtual void addAppender (Appender &appender)
void alert (const char *stringFormat,...) throw ()
void alert (const std::string &message) throw ()
CategoryStream alertStream () throw ()
virtual void callAppenders (const LoggingEvent &event) throw ()
void crit (const char *stringFormat,...) throw ()
void crit (const std::string &message) throw ()
CategoryStream critStream ()
void debug (const char *stringFormat,...) throw ()
void debug (const std::string &message) throw ()
CategoryStream debugStream ()
void emerg (const char *stringFormat,...) throw ()
void emerg (const std::string &message) throw ()
CategoryStream emergStream ()
void error (const char *stringFormat,...) throw ()
void error (const std::string &message) throw ()
CategoryStream errorStream ()
void fatal (const char *stringFormat,...) throw ()
void fatal (const std::string &message) throw ()
CategoryStream fatalStream ()
virtual bool getAdditivity () const throw ()
virtual AppenderSet getAllAppenders () const
virtual AppendergetAppender () const
virtual AppendergetAppender (const std::string &name) const
virtual Priority::Value getChainedPriority () const throw ()
virtual const std::string & getName () const throw ()
virtual CategorygetParent () throw ()
virtual const CategorygetParent () const throw ()
virtual Priority::Value getPriority () const throw ()
virtual CategoryStream getStream (Priority::Value priority)
void info (const char *stringFormat,...) throw ()
void info (const std::string &message) throw ()
void info_pop (const char *stringFormat,...) throw ()
void info_push (const char *stringFormat,...) throw ()
CategoryStream infoStream ()
bool isAlertEnabled () const throw ()
bool isCritEnabled () const throw ()
bool isDebugEnabled () throw ()
bool isEmergEnabled () const throw ()
bool isErrorEnabled () const throw ()
bool isFatalEnabled () const throw ()
bool isInfoEnabled () throw ()
bool isNoticeEnabled () const throw ()
virtual bool isPriorityEnabled (Priority::Value priority) const throw ()
bool isWarnEnabled () throw ()
virtual void log (Priority::Value priority, const char *stringFormat,...) throw ()
virtual void log (Priority::Value priority, const std::string &message) throw ()
virtual void logva (Priority::Value priority, const char *stringFormat, va_list va) throw ()
void notice (const char *stringFormat,...) throw ()
void notice (const std::string &message) throw ()
CategoryStream noticeStream ()
virtual CategoryStream operator<< (Priority::Value priority)
virtual bool ownsAppender () const throw ()
virtual bool ownsAppender (Appender *appender) const throw ()
virtual void removeAllAppenders ()
virtual void removeAppender (Appender *appender)
virtual void setAdditivity (bool additivity)
void setAppender (Appender *appender)
void setAppender (Appender &appender)
virtual void setPriority (Priority::Value priority)
void warn (const char *stringFormat,...) throw ()
void warn (const std::string &message) throw ()
CategoryStream warnStream ()
virtual ~Category ()

Static Public Member Functions

static Categoryexists (const std::string &name)
static std::vector< Category * > * getCurrentCategories ()
static CategorygetInstance (const std::string &name)
static CategorygetRoot ()
static Priority::Value getRootPriority () throw ()
static void setRootPriority (Priority::Value priority)
static void shutdown ()

Protected Member Functions

virtual void _logUnconditionally (Priority::Value priority, const char *format, va_list arguments) throw ()
virtual void _logUnconditionally2 (Priority::Value priority, const std::string &message) throw ()
 Category (const std::string &name, Category *parent, Priority::Value priority=Priority::NOTSET)

Private Types

typedef std::map< Appender
*, bool
OwnsAppenderMap

Private Member Functions

 Category (const Category &other)
void InvalidateEnabledCache (bool InvalidateAll=true)
 Invalidates the enabled caches for the different priorities.
Categoryoperator= (const Category &other)
virtual bool ownsAppender (Appender *appender, OwnsAppenderMap::iterator &i2) throw ()

Private Attributes

AppenderSet _appender
threading::Mutex _appenderSetMutex
bool _DebugEnabled
 Indicates that logging is enabled for Info level.
bool _InfoEnabled
 Indicates that logging is enabled for Info level.
volatile bool _isAdditive
const std::string _name
OwnsAppenderMap _ownsAppender
Category_parent
volatile Priority::Value _priority
bool _ValidDebugEnabledCache
 Indicates if the *Enabled flags are valid.
bool _ValidInfoEnabledCache
 Indicates if the *Enabled flags are valid.
bool _ValidWarnEnabledCache
 Indicates if the *Enabled flags are valid.
bool _WarnEnabled
 Indicates that logging is enabled for Info level.

Friends

class HierarchyMaintainer

Detailed Description

This is the central class in the log4j package. One of the distintive features of log4j (and hence log4cpp) are hierarchal categories and their evaluation.

Definition at line 34 of file Category.hh.


Member Typedef Documentation

typedef std::map<Appender *, bool> Category::OwnsAppenderMap [private]

Definition at line 673 of file Category.hh.


Constructor & Destructor Documentation

virtual Category::~Category ( ) [virtual]

Destructor for Category.

Category::Category ( const std::string &  name,
Category parent,
Priority::Value  priority = Priority::NOTSET 
) [protected]

Constructor

Parameters:
namethe fully qualified name of this Category
parentthe parent of this parent, or NULL for the root Category
prioritythe priority for this Category. Defaults to Priority::NOTSET
Category::Category ( const Category other) [private]

Member Function Documentation

virtual void Category::_logUnconditionally ( Priority::Value  priority,
const char *  format,
va_list  arguments 
) throw () [protected, virtual]
virtual void Category::_logUnconditionally2 ( Priority::Value  priority,
const std::string &  message 
) throw () [protected, virtual]

Unconditionally log a message with the specified priority.

Parameters:
priorityThe priority of this log message.
messagestring to write in the log file

Reimplemented in FixedContextCategory.

virtual void Category::addAppender ( Appender appender) [virtual]

Adds an Appender to this Category. This method passes ownership from the caller to the Category.

Since:
0.2.7
Parameters:
appenderThe Appender to wich this category has to log.
Exceptions:
GenICam::InvalidArgumentExceptionif the appender is NULL.

Reimplemented in FixedContextCategory.

virtual void Category::addAppender ( Appender appender) [virtual]

Adds an Appender for this Category. This method does not pass ownership from the caller to the Category.

Since:
0.2.7
Parameters:
appenderThe Appender this category has to log to.

Reimplemented in FixedContextCategory.

void Category::alert ( const char *  stringFormat,
  ... 
) throw ()

Log a message with alert priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::alert ( const std::string &  message) throw ()

Log a message with alert priority.

Parameters:
messagestring to write in the log file
CategoryStream Category::alertStream ( ) throw () [inline]

Return a CategoryStream with priority ALERT.

Returns:
The CategoryStream.

Definition at line 542 of file Category.hh.

virtual void Category::callAppenders ( const LoggingEvent event) throw () [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:
eventthe LogginEvent to log.

Reimplemented in FixedContextCategory.

void Category::crit ( const char *  stringFormat,
  ... 
) throw ()

Log a message with crit priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::crit ( const std::string &  message) throw ()

Log a message with crit priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority CRIT.

Returns:
The CategoryStream.

Definition at line 512 of file Category.hh.

void Category::debug ( const char *  stringFormat,
  ... 
) throw ()

Log a message with debug priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::debug ( const std::string &  message) throw ()

Log a message with debug priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority DEBUG.

Returns:
The CategoryStream.

Definition at line 336 of file Category.hh.

void Category::emerg ( const char *  stringFormat,
  ... 
) throw ()

Log a message with emerg priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::emerg ( const std::string &  message) throw ()

Log a message with emerg priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority EMERG.

Returns:
The CategoryStream.

Definition at line 572 of file Category.hh.

void Category::error ( const char *  stringFormat,
  ... 
) throw ()

Log a message with error priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::error ( const std::string &  message) throw ()

Log a message with error priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority ERROR.

Returns:
The CategoryStream.

Definition at line 482 of file Category.hh.

static Category* Category::exists ( const std::string &  name) [static]

If the named category exists (in the default hierarchy) then it returns a reference to the category, otherwise it returns NULL.

Since:
0.2.7
void Category::fatal ( const char *  stringFormat,
  ... 
) throw ()

Log a message with fatal priority. NB. priority 'fatal' is equivalent to 'emerg'.

Since:
0.2.7
Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::fatal ( const std::string &  message) throw ()

Log a message with fatal priority. NB. priority 'fatal' is equivalent to 'emerg'.

Since:
0.2.7
Parameters:
messagestring to write in the log file

Return a CategoryStream with priority FATAL. NB. priority 'fatal' is equivalent to 'emerg'.

Since:
0.2.7
Returns:
The CategoryStream.

Definition at line 610 of file Category.hh.

virtual bool Category::getAdditivity ( ) const throw () [virtual]

Returns the additivity flag for this Category instance.

Reimplemented in FixedContextCategory.

virtual AppenderSet Category::getAllAppenders ( ) const [virtual]

Returns the set of Appenders currently attached to this Catogory.

Since:
0.3.1
Returns:
The set of attached Appenders.

Reimplemented in FixedContextCategory.

virtual Appender* Category::getAppender ( ) const [virtual]

Returns the first Appender for this Category, or NULL if no Appender has been set.

Deprecated:
use getAppender(const std::string&)
Returns:
The Appender.

Reimplemented in FixedContextCategory.

virtual Appender* Category::getAppender ( const std::string &  name) const [virtual]

Returns the specified Appender for this Category, or NULL if the Appender is not attached to this Category.

Since:
0.2.7
Returns:
The Appender.

Reimplemented in FixedContextCategory.

virtual Priority::Value Category::getChainedPriority ( ) const throw () [virtual]

Starting from this Category, search the category hierarchy for a set priority and return it. Otherwise, return the priority of the root category.

The Category class is designed so that this method executes as quickly as possible.

Reimplemented in FixedContextCategory.

static std::vector<Category*>* Category::getCurrentCategories ( ) [static]

Returns all the currently defined categories as a vector of Category pointers. Note: this function does not pass ownership of the categories in the vector to the caller, only the ownership of the vector. However vector<Category&>* is not legal C++, so we can't follow the default ownership conventions.

Unlike in log4j, the root category is included in the returned set.

Since:
0.3.2. Before 0.3.2 this method returned a std::set
static Category& Category::getInstance ( const std::string &  name) [static]

Instantiate a Category with name name. This method does not set priority of the category which is by default Priority::NOTSET.

Parameters:
nameThe name of the category to retrieve.
virtual const std::string& Category::getName ( ) const throw () [virtual]

Return the category name.

Returns:
The category name.
virtual Category* Category::getParent ( ) throw () [virtual]

Returns the parent category of this category, or NULL if the category is the root category.

Returns:
the parent category.
virtual const Category* Category::getParent ( ) const throw () [virtual]

Returns the parent category of this category, or NULL if the category is the root category.

Returns:
the parent category.
virtual Priority::Value Category::getPriority ( ) const throw () [virtual]

Returns the assigned Priority, if any, for this Category.

Returns:
Priority - the assigned Priority, can be Priority::NOTSET

Reimplemented in FixedContextCategory.

static Category& Category::getRoot ( ) [static]

Return the root of the Category hierarchy.

The root category is always instantiated and available. It's name is the empty string.

Unlike in log4j, calling Category.getInstance("") does retrieve the root category and not a category just under root named "".

Returns:
The root category
static Priority::Value Category::getRootPriority ( ) throw () [static]

Get the priority of the root Category.

Returns:
the priority of the root category
virtual CategoryStream Category::getStream ( Priority::Value  priority) [virtual]

Return a CategoryStream with given Priority.

Parameters:
priorityThe Priority of the CategoryStream.
Returns:
The requested CategoryStream.
void Category::info ( const char *  stringFormat,
  ... 
) throw ()

Log a message with info priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::info ( const std::string &  message) throw ()

Log a message with info priority.

Parameters:
messagestring to write in the log file
void Category::info_pop ( const char *  stringFormat,
  ... 
) throw ()

Log a message with info priority & pops an indentation to the NDC stack

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::info_push ( const char *  stringFormat,
  ... 
) throw ()

Log a message with info priority & pushes an indentation to the NDC stack

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat

Return a CategoryStream with priority INFO.

Returns:
The CategoryStream.

Definition at line 387 of file Category.hh.

void Category::InvalidateEnabledCache ( bool  InvalidateAll = true) [private]

Invalidates the enabled caches for the different priorities.

bool Category::isAlertEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority ALERT.

Returns:
Whether the Category will log.

Definition at line 534 of file Category.hh.

bool Category::isCritEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority CRIT.

Returns:
Whether the Category will log.

Definition at line 504 of file Category.hh.

bool Category::isDebugEnabled ( ) throw () [inline]

Return true if the Category will log messages with priority DEBUG.

Returns:
Whether the Category will log.

Definition at line 323 of file Category.hh.

bool Category::isEmergEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority EMERG.

Returns:
Whether the Category will log.

Definition at line 564 of file Category.hh.

bool Category::isErrorEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority ERROR.

Returns:
Whether the Category will log.

Definition at line 474 of file Category.hh.

bool Category::isFatalEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority FATAL. NB. priority 'fatal' is equivalent to 'emerg'.

Since:
0.2.7
Returns:
Whether the Category will log.

Definition at line 600 of file Category.hh.

bool Category::isInfoEnabled ( ) throw () [inline]

Return true if the Category will log messages with priority INFO.

Returns:
Whether the Category will log.

Definition at line 374 of file Category.hh.

bool Category::isNoticeEnabled ( ) const throw () [inline]

Return true if the Category will log messages with priority NOTICE.

Returns:
Whether the Category will log.

Definition at line 409 of file Category.hh.

virtual bool Category::isPriorityEnabled ( Priority::Value  priority) const throw () [virtual]

Returns true if the chained priority of the Category is equal to or higher than given priority.

Parameters:
priorityThe priority to compare with.
Returns:
whether logging is enable for this priority.
bool Category::isWarnEnabled ( ) throw () [inline]

Return true if the Category will log messages with priority WARN.

Returns:
Whether the Category will log.

Definition at line 439 of file Category.hh.

virtual void Category::log ( Priority::Value  priority,
const char *  stringFormat,
  ... 
) throw () [virtual]

Log a message with the specified priority.

Parameters:
priorityThe priority of this log message.
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
virtual void Category::log ( Priority::Value  priority,
const std::string &  message 
) throw () [virtual]

Log a message with the specified priority.

Parameters:
priorityThe priority of this log message.
messagestring to write in the log file
virtual void Category::logva ( Priority::Value  priority,
const char *  stringFormat,
va_list  va 
) throw () [virtual]

Log a message with the specified priority.

Since:
0.2.7
Parameters:
priorityThe priority of this log message.
stringFormatFormat specifier for the string to write in the log file.
vaThe arguments for stringFormat.
void Category::notice ( const char *  stringFormat,
  ... 
) throw ()

Log a message with notice priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::notice ( const std::string &  message) throw ()

Log a message with notice priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority NOTICE.

Returns:
The CategoryStream.

Definition at line 417 of file Category.hh.

virtual CategoryStream Category::operator<< ( Priority::Value  priority) [virtual]

Return a CategoryStream with given Priority.

Parameters:
priorityThe Priority of the CategoryStream.
Returns:
The requested CategoryStream.
Category& Category::operator= ( const Category other) [private]
virtual bool Category::ownsAppender ( ) const throw () [inline, virtual]

Returns true if the Category owns the first Appender in its Appender set. In that case the Category destructor will delete the Appender.

Deprecated:
use ownsAppender(Appender*)

Reimplemented in FixedContextCategory.

Definition at line 227 of file Category.hh.

virtual bool Category::ownsAppender ( Appender appender) const throw () [virtual]

Returns true if the Category owns the Appender. In that case the Category destructor will delete the Appender.

Since:
0.2.7

Reimplemented in FixedContextCategory.

virtual bool Category::ownsAppender ( Appender appender,
OwnsAppenderMap::iterator &  i2 
) throw () [private, virtual]

Returns the iterator to the Appender if the Category owns the Appender. In that case the Category destructor will delete the Appender.

virtual void Category::removeAllAppenders ( ) [virtual]

Removes all appenders for this Category.

Reimplemented in FixedContextCategory.

virtual void Category::removeAppender ( Appender appender) [virtual]

Removes specified appender for this Category.

Since:
0.2.7
virtual void Category::setAdditivity ( bool  additivity) [virtual]

Set the additivity flag for this Category instance.

Reimplemented in FixedContextCategory.

void Category::setAppender ( Appender appender) [inline]

Adds an Appender to this Category. This method passes ownership from the caller to the Category.

Deprecated:
use addAppender(Appender*) or removeAllAppenders() instead.
Parameters:
appenderThe Appender this category has to log to or NULL to remove the current Appenders.

Definition at line 169 of file Category.hh.

void Category::setAppender ( Appender appender) [inline]

Adds an Appender for this Category. This method does not pass ownership from the caller to the Category.

Deprecated:
use addAppender(Appender&) instead.
Parameters:
appenderThe Appender this category has to log to.

Definition at line 183 of file Category.hh.

virtual void Category::setPriority ( Priority::Value  priority) [virtual]

Set the priority of this Category.

Parameters:
priorityThe priority to set. Use Priority::NOTSET to let the category use its parents priority as effective priority.
Exceptions:
std::invalid_argumentif the caller tries to set Priority::NOTSET on the Root Category.
static void Category::setRootPriority ( Priority::Value  priority) [static]

Set the priority of the root Category.

Parameters:
priorityThe new priority for the root Category
static void Category::shutdown ( ) [static]

This method will remove all Appenders from Categories.XXX

void Category::warn ( const char *  stringFormat,
  ... 
) throw ()

Log a message with warn priority.

Parameters:
stringFormatFormat specifier for the string to write in the log file.
...The arguments for stringFormat
void Category::warn ( const std::string &  message) throw ()

Log a message with warn priority.

Parameters:
messagestring to write in the log file

Return a CategoryStream with priority WARN.

Returns:
The CategoryStream.

Definition at line 452 of file Category.hh.


Friends And Related Function Documentation

friend class HierarchyMaintainer [friend]

Definition at line 35 of file Category.hh.


Member Data Documentation

Definition at line 684 of file Category.hh.

Definition at line 685 of file Category.hh.

Indicates that logging is enabled for Info level.

Definition at line 710 of file Category.hh.

Indicates that logging is enabled for Info level.

Definition at line 704 of file Category.hh.

volatile bool Category::_isAdditive [private]

Additivity is set to true by default, i.e. a child inherits its ancestor's appenders by default.

Definition at line 698 of file Category.hh.

const std::string Category::_name [private]

The name of this category.

Definition at line 660 of file Category.hh.

Whether the category holds the ownership of the appender. If so, it deletes the appender in its destructor.

Definition at line 692 of file Category.hh.

The parent of this category. All categories have al least one ancestor which is the root category.

Definition at line 666 of file Category.hh.

The assigned priority of this category.

Definition at line 671 of file Category.hh.

Indicates if the *Enabled flags are valid.

Definition at line 707 of file Category.hh.

Indicates if the *Enabled flags are valid.

Definition at line 701 of file Category.hh.

Indicates if the *Enabled flags are valid.

Definition at line 713 of file Category.hh.

Indicates that logging is enabled for Info level.

Definition at line 716 of file Category.hh.


The documentation for this class was generated from the following file:


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:10