BDE 4.39.x Production Release
Loading...
Searching...
No Matches
ball::Category Class Reference

#include <ball_category.h>

Detailed Description

This class provides a container to hold the name and threshold levels of a category. Instances of Category are created and manipulated by CategoryManager. All threshold levels are integral values in the range [0 .. 255].

Implementation Note: The d_ruleThreshold and d_relevantRuleMask serve as a cache for logging rule evaluation (see ball_attributecontext ). They are not meant to be modified by users of the logging system, and may be modified by const operations of the logging system.

See ball_category

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (Category, bslma::UsesBslmaAllocator)
 
 Category (const bsl::string_view &categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel, bslma::Allocator *basicAllocator=0)
 
 ~Category ()=default
 
int setLevels (int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
 
const char * categoryName () const
 
bool isEnabled (int level) const
 
int maxLevel () const
 
int recordLevel () const
 
int passLevel () const
 
int triggerLevel () const
 
int triggerAllLevel () const
 
ThresholdAggregate thresholdLevels () const
 
int threshold () const
 
int ruleThreshold () const
 
RuleSet::MaskType relevantRuleMask () const
 

Static Public Member Functions

static bool areValidThresholdLevels (int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
 

Friends

class CategoryManagerImpUtil
 

Constructor & Destructor Documentation

◆ Category()

ball::Category::Category ( const bsl::string_view categoryName,
int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel,
bslma::Allocator basicAllocator = 0 
)

Create a category having the specified categoryName and the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold values, respectively. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

Precondition
The behavior is undefined unless each of the specified threshold levels is in the range [0 .. 255].

◆ ~Category()

ball::Category::~Category ( )
default

Destroy this object.

Member Function Documentation

◆ areValidThresholdLevels()

bool ball::Category::areValidThresholdLevels ( int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)
inlinestatic

Return true if each of the specified recordLevel, passLevel, triggerLevel and triggerAllLevel threshold values are in the range [0 .. 255], and false otherwise.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

ball::Category::BSLMF_NESTED_TRAIT_DECLARATION ( Category  ,
bslma::UsesBslmaAllocator   
)

◆ categoryName()

const char * ball::Category::categoryName ( ) const
inline

Return the name of this category.

◆ isEnabled()

bool ball::Category::isEnabled ( int  level) const
inline

Return true if logging at the specified level is enabled for this category, and false otherwise. Logging is enabled if level is numerically less than or equal to any of the four threshold levels of this category.

◆ maxLevel()

int ball::Category::maxLevel ( ) const
inline

Return the numerical maximum of the four levels of this category.

◆ passLevel()

int ball::Category::passLevel ( ) const
inline

Return the pass level of this category.

◆ recordLevel()

int ball::Category::recordLevel ( ) const
inline

Return the record level of this category.

◆ relevantRuleMask()

RuleSet::MaskType ball::Category::relevantRuleMask ( ) const
inline

Return a reference to the non-modifiable relevant rule mask for this category. The returned RuleSet::MaskType value is a bit-mask, where each bit is a boolean value indicating whether the rule at the corresponding index (in the rule set of the category manager that owns this category) applies at this category.

Note
Note that a rule applies to this category if the rule's pattern matches the name returned by categoryName.

◆ ruleThreshold()

int ball::Category::ruleThreshold ( ) const
inline

Return the current maximum threshold (i.e., the lowest severity) for any logging rule associated with this category.

Note
Note that the rule having this threshold may not be active given the current thread's logging context (see ball::AttributeContext); this value caches the lowest possible severity where the currently rules need to be evaluated (log records below this threshold do not need any rule evaluation).

◆ setLevels()

int ball::Category::setLevels ( int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)

Set the threshold levels of this category to the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel values, respectively, if each of the specified values is in the range [0 .. 255]. Return 0 on success, and a non-zero value otherwise (with no effect on the threshold levels of this category).

◆ threshold()

int ball::Category::threshold ( ) const
inline

Return the current maximum threshold (i.e., the lowest severity) between the recordLevel, passLevel, triggerLevel, and triggerAllLevel.

Note
Note that this is the threshold at which a log record having this severity will need to be acted upon.

◆ thresholdLevels()

ThresholdAggregate ball::Category::thresholdLevels ( ) const
inline

Return the aggregate threshold levels of this category.

◆ triggerAllLevel()

int ball::Category::triggerAllLevel ( ) const
inline

Return the trigger-all level of this category.

◆ triggerLevel()

int ball::Category::triggerLevel ( ) const
inline

Return the trigger level of this category.

Friends And Related Symbol Documentation

◆ CategoryManagerImpUtil

friend class CategoryManagerImpUtil
friend

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