Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions | Static Public Member Functions | Friends

ball::LoggerManager Class Reference

#include <ball_loggermanager.h>

List of all members.

Public Types

typedef
LoggerManagerConfiguration::CategoryNameFilterCallback 
CategoryNameFilterCallback
typedef
LoggerManagerConfiguration::DefaultThresholdLevelsCallback 
DefaultThresholdLevelsCallback
typedef
Logger::PublishAllTriggerCallback 
PublishAllTriggerCallback
typedef
LoggerManagerConfiguration::UserFieldsPopulatorCallback 
UserFieldsPopulatorCallback
typedef
AttributeCollectorRegistry::Collector 
AttributeCollector
typedef
AttributeCollectorRegistry::Visitor 
AttributeVisitor
typedef
BroadcastObserver::ObserverRegistry 
ObserverRegistry

Public Member Functions

 LoggerManager (const LoggerManagerConfiguration &configuration, bslma::Allocator *globalAllocator=0)
 ~LoggerManager ()
LoggerallocateLogger (RecordBuffer *buffer)
LoggerallocateLogger (RecordBuffer *buffer, int scratchBufferSize)
LoggerallocateLogger (RecordBuffer *buffer, Observer *observer)
LoggerallocateLogger (RecordBuffer *buffer, int scratchBufferSize, Observer *observer)
LoggerallocateLogger (RecordBuffer *buffer, const bsl::shared_ptr< Observer > &observer)
LoggerallocateLogger (RecordBuffer *buffer, int scratchBufferSize, const bsl::shared_ptr< Observer > &observer)
void deallocateLogger (Logger *logger)
LoggergetLogger ()
void setLogger (Logger *logger)
CategoryaddCategory (const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
CategorydefaultCategory ()
CategorylookupCategory (const char *categoryName)
const CategorysetCategory (const char *categoryName)
const CategorysetCategory (CategoryHolder *categoryHolder, const char *categoryName)
CategorysetCategory (const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
void setMaxNumCategories (int length)
void deregisterAllObservers ()
int deregisterObserver (const bsl::string_view &observerName)
int deregisterAttributeCollector (const bsl::string_view &collectorName)
bsl::shared_ptr< ObserverfindObserver (const bsl::string_view &observerName)
template<class t_OBSERVER >
int findObserver (bsl::shared_ptr< t_OBSERVER > *result, const bsl::string_view &observerName)
Observerobserver ()
int registerObserver (const bsl::shared_ptr< Observer > &observer, const bsl::string_view &observerName)
int registerAttributeCollector (const AttributeCollector &collector, const bsl::string_view &collectorName)
void resetDefaultThresholdLevels ()
void setCategoryThresholdsToCurrentDefaults (Category *category)
void setCategoryThresholdsToFactoryDefaults (Category *category)
int setDefaultThresholdLevels (int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel)
void setDefaultThresholdLevelsCallback (DefaultThresholdLevelsCallback *callback)
int addRule (const Rule &value)
int addRules (const RuleSet &ruleSet)
void removeAllRules ()
int removeRule (const Rule &value)
int removeRules (const RuleSet &ruleSet)
void publishAll ()
template<class t_CATEGORY_VISITOR >
void visitCategories (const t_CATEGORY_VISITOR &visitor)
template<class t_OBSERVER_VISITOR >
void visitObservers (BSLS_COMPILERFEATURES_FORWARD_REF(t_OBSERVER_VISITOR) visitor)
bslma::Allocatorallocator () const
const CategorydefaultCategory () const
int defaultPassThresholdLevel () const
int defaultRecordThresholdLevel () const
int defaultTriggerAllThresholdLevel () const
int defaultTriggerThresholdLevel () const
bsl::shared_ptr< const ObserverfindObserver (const bsl::string_view &observerName) const
template<class t_OBSERVER >
int findObserver (bsl::shared_ptr< const t_OBSERVER > *result, const bsl::string_view &observerName) const
bool isCategoryEnabled (const Category *category, int severity) const
const CategorylookupCategory (const char *categoryName) const
int maxNumCategories () const
int numCategories () const
const Observerobserver () const
const RuleSetruleSet () const
const UserFieldsPopulatorCallbackuserFieldsPopulatorCallback () const
template<class t_CATEGORY_VISITOR >
void visitCategories (const t_CATEGORY_VISITOR &visitor) const
template<class t_OBSERVER_VISITOR >
void visitObservers (BSLS_COMPILERFEATURES_FORWARD_REF(t_OBSERVER_VISITOR) visitor) const
const ThresholdAggregatedefaultThresholdLevels () const
int thresholdLevelsForNewCategory (ThresholdAggregate *levels, const char *categoryName) const

Static Public Member Functions

static void createLoggerManager (bslma::ManagedPtr< LoggerManager > *manager, Observer *observer, const LoggerManagerConfiguration &configuration, bslma::Allocator *basicAllocator=0)
static void createLoggerManager (bslma::ManagedPtr< LoggerManager > *manager, const LoggerManagerConfiguration &configuration, bslma::Allocator *basicAllocator=0)
static RecordgetRecord (const char *fileName, int lineNumber)
static LoggerManagerinitSingleton (Observer *observer, bslma::Allocator *globalAllocator=0)
static LoggerManagerinitSingleton (Observer *observer, const LoggerManagerConfiguration &configuration, bslma::Allocator *globalAllocator=0)
static LoggerManagerinitSingleton (bslma::Allocator *globalAllocator=0)
static LoggerManagerinitSingleton (const LoggerManagerConfiguration &configuration, bslma::Allocator *globalAllocator=0)
static int initSingleton (LoggerManager *singleton, bool adoptSingleton=false)
static bool isInitialized ()
static void logMessage (int severity, Record *record)
static char * obtainMessageBuffer (bslmt::Mutex **mutex, int *bufferSize)
static bslma::ManagedPtr< char > obtainMessageBuffer (int *bufferSize)
static void shutDownSingleton ()
static LoggerManagersingleton ()

Friends

class LoggerManagerCategoryIter
class LoggerManagerCategoryManip

Detailed Description

This class is usually a singleton. It provides a factory for Logger objects and is also a wrapper for category administration services. Note that some services provided by this class are available only after the singleton has been initialized.

See Component ball_loggermanager


Member Typedef Documentation


Constructor & Destructor Documentation

ball::LoggerManager::LoggerManager ( const LoggerManagerConfiguration configuration,
bslma::Allocator globalAllocator = 0 
) [explicit]

Create a logger manager having the specified configuration of defaults and attributes. Optionally specify a globalAllocator used to supply memory. If globalAllocator is 0, the currently installed global allocator is used. Note that the new logger manager is not the singleton logger manager used by macros of the BALL logging framework.

ball::LoggerManager::~LoggerManager (  ) 

Destroy this logger manager.


Member Function Documentation

static void ball::LoggerManager::createLoggerManager ( bslma::ManagedPtr< LoggerManager > *  manager,
Observer observer,
const LoggerManagerConfiguration configuration,
bslma::Allocator basicAllocator = 0 
) [static]

Create a logger manager that is not the singleton logger manager having the specified observer that receives published log records and the specified configuration of defaults and attributes; load the newly-created logger manager into the specified manager managed pointer. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined if observer is 0, goes out of scope, or is otherwise destroyed. Note that this method does not create the singleton logger manager used by the macros of the BALL logging framework.

DEPRECATED: Use the createLoggerManager method that does not take a raw pointer to an observer, together with the registerObserver method (which takes a shared pointer to an observer), instead.

static void ball::LoggerManager::createLoggerManager ( bslma::ManagedPtr< LoggerManager > *  manager,
const LoggerManagerConfiguration configuration,
bslma::Allocator basicAllocator = 0 
) [static]

Create a logger manager that is not the singleton logger manager having the specified configuration of defaults and attributes; load the newly-created logger manager into the specified manager managed pointer. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. Note that this method does not create the singleton logger manager used by the macros of the BALL logging framework.

static Record* ball::LoggerManager::getRecord ( const char *  fileName,
int  lineNumber 
) [static]

Return the address of a modifiable record with the specified fileName and lineNumber attributes, and whose memory is supplied by the currently installed default allocator. Note that the returned Record must subsequently be supplied to a call to the LoggerManager::logMessage method.

static LoggerManager& ball::LoggerManager::initSingleton ( Observer observer,
bslma::Allocator globalAllocator = 0 
) [static]
static LoggerManager& ball::LoggerManager::initSingleton ( Observer observer,
const LoggerManagerConfiguration configuration,
bslma::Allocator globalAllocator = 0 
) [static]

Initialize the logger manager singleton having the specified observer that receives published log records. Optionally specify a configuration describing how the singleton should be configured. If configuration is not specified, a default constructed LoggerManagerConfiguration object is used. Optionally specify a globalAllocator used to supply memory. If globalAllocator is 0, the currently installed global allocator is used. Return a non-'const' reference to the logger manager singleton. This method has no effect (aside from logging a warning) if the logger manager singleton already exists. The behavior is undefined if observer is 0, goes out of scope, or is otherwise destroyed.

DEPRECATED: Use the initSingleton method that does not take a raw pointer to an observer, together with the registerObserver method (which takes a shared pointer to an observer), instead.

static LoggerManager& ball::LoggerManager::initSingleton ( bslma::Allocator globalAllocator = 0  )  [static]
static LoggerManager& ball::LoggerManager::initSingleton ( const LoggerManagerConfiguration configuration,
bslma::Allocator globalAllocator = 0 
) [static]

Initialize the logger manager singleton. Optionally specify a configuration describing how the singleton should be configured. If configuration is not specified, a default constructed LoggerManagerConfiguration object is used. Optionally specify a globalAllocator used to supply memory. If globalAllocator is 0, the currently installed global allocator is used. Return a non-'const' reference to the logger manager singleton. This method has no effect (aside from logging a warning) if the logger manager singleton already exists.

static int ball::LoggerManager::initSingleton ( LoggerManager singleton,
bool  adoptSingleton = false 
) [static]

Initialize the logger manager singleton with the specified singleton. Optionally specify an adoptSingleton flag indicating whether this method takes ownership of singleton, in which case shutDownSingleton will destroy singleton. If adoptSingleton is not specified, this method does not take ownership of singleton (and shutDownSingleton will not destroy it). Return 0 if the logger manager singleton was successfully initialized, and a non-zero value otherwise. This method has no effect (aside from logging a warning) if the logger manager singleton already exists, in which case this method does not take ownership of singleton regardless of the value of adoptSingleton. Note that this version of initSingleton is meant for use only on Windows to initialize another dynamically loaded copy of the LoggerManager system. Also note that a suitable singleton may be obtained by calling createLoggerManager, or from the singleton class method of an already-initialized LoggerManager system.

static bool ball::LoggerManager::isInitialized (  )  [static]

Return true if the logger manager singleton exists, and false otherwise.

static void ball::LoggerManager::logMessage ( int  severity,
Record record 
) [static]

Publish the specified record using bsls::Log::platformDefaultMessageHandler after setting its severity attribute to the specified severity, and dispose of record. The behavior is undefined unless record was obtained by a call to the LoggerManager::getRecord method. Note that record will be invalid after this method returns.

static char* ball::LoggerManager::obtainMessageBuffer ( bslmt::Mutex **  mutex,
int *  bufferSize 
) [static]

Block until access to the static buffer used for formatting messages is available. Return the address of the modifiable buffer to which this thread of execution has exclusive access, load the address of the mutex that protects the buffer into the specified *mutex address, and load the size (in bytes) of the buffer into the specified bufferSize address. The address remains valid, and the buffer remains locked by this thread of execution, this thread calls mutex->unlock(). The behavior is undefined if this thread of execution currently holds a lock on the buffer. Note that the buffer is intended to be used only for formatting log messages immediately before calling logMessage; other use may adversely affect performance for the entire program.

static bslma::ManagedPtr<char> ball::LoggerManager::obtainMessageBuffer ( int *  bufferSize  )  [static]

Return a managed pointer that refers to the memory block to which this thread of execution has exclusive access and load the size (in bytes) of this buffer into the specified bufferSize address. Note that this method is intended for internal use only.

static void ball::LoggerManager::shutDownSingleton (  )  [static]

Destroy the logger manager singleton and release all resources used by it. This method has no effect if the logger manager singleton does not exist (i.e., it has not been initialized or has already been destroyed). The behavior is undefined if this method is called from one thread while another thread is accessing the logger manager singleton (i.e., this method is not thread-safe).

static LoggerManager& ball::LoggerManager::singleton (  )  [static]

Return a non-'const' reference to the logger manager singleton. The behavior is undefined unless the logger manager singleton exists.

Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer  ) 
Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer,
int  scratchBufferSize 
)

Return the address of a modifiable logger managed by this logger manager configured with the specified record buffer. Optionally specify a scratchBufferSize for the logger's user-accessible message buffer. If scratchBufferSize is not specified, the value configured at construction is used. Note that this method is primarily intended for use in multi-threaded applications, but can be used to partition logging streams even within a single thread. Also note that ownership of buffer is not transferred, and hence, will not be destroyed (or otherwise affected) after the logger is deallocated.

Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer,
Observer observer 
)
Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer,
int  scratchBufferSize,
Observer observer 
)

Return the address of a modifiable logger managed by this logger manager having the specified observer that receives published log records and configured with the specified record buffer. Optionally specify a scratchBufferSize for the logger's user-accessible message buffer. If scratchBufferSize is not specified, the value configured at construction is used. Note that this method is primarily intended for use in multi-threaded applications, but can be used to partition logging streams even within a single thread. Also note that ownership of buffer and observer is not transferred, and hence, will not be destroyed (or otherwise affected) after the logger is deallocated.

DEPRECATED: Use the allocateLogger method that does not take a raw pointer to an observer, together with the registerObserver method (which takes a shared pointer to an observer), instead.

Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer,
const bsl::shared_ptr< Observer > &  observer 
)
Logger* ball::LoggerManager::allocateLogger ( RecordBuffer buffer,
int  scratchBufferSize,
const bsl::shared_ptr< Observer > &  observer 
)

Return the address of a modifiable logger managed by this logger manager having the specified observer that receives published log records and configured with the specified record buffer. Optionally specify a scratchBufferSize for the logger's user-accessible message buffer. If scratchBufferSize is not specified, the value configured at construction is used. Note that this method is primarily intended for use in multi-threaded applications, but can be used to partition logging streams even within a single thread. Also note that ownership of buffer and observer is not transferred, and hence, will not be destroyed (or otherwise affected) after the logger is deallocated.

void ball::LoggerManager::deallocateLogger ( Logger logger  ) 

Deallocate the specified logger and release logger from management by this logger manager. The behavior is undefined unless logger was obtained by invoking the allocateLogger method of this logger manager and logger has not yet been deallocated. Note that this method is intended primarily for multi-threaded applications.

Logger& ball::LoggerManager::getLogger (  ) 

Return a non-'const' reference to a logger managed by this logger manager suitable for performing logging operations for this thread of execution.

void ball::LoggerManager::setLogger ( Logger logger  ) 

Set the default logger used by this thread of execution to the specified logger, or to the global default logger if logger is 0. The behavior is undefined unless logger was obtained from this logger manager, and this thread of execution does not hold exclusive access to the record buffer of its current default logger.

Category* ball::LoggerManager::addCategory ( const char *  categoryName,
int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)

Add to the category registry of this logger manager a new category having the specified categoryName and the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold levels, respectively, if (1) categoryName is not present in the registry, (2) the number of categories in the registry is less than the registry capacity, and (3) each threshold level is in the range [0 .. 255]. Return the address of the new modifiable category on success, and 0 otherwise. The behavior is undefined unless categoryName is null-terminated.

Category& ball::LoggerManager::defaultCategory (  ) 

Return a non-'const' reference to the Default Category in the category registry of this logger manager.

Category* ball::LoggerManager::lookupCategory ( const char *  categoryName  ) 

Return the address of the modifiable category in the category registry of this logger manager having the specified categoryName, or 0 if no such category exists. The behavior is undefined unless categoryName is null-terminated.

const Category* ball::LoggerManager::setCategory ( const char *  categoryName  ) 

Add to the category registry of this logger manager a new category having the specified categoryName and default threshold levels if categoryName is not present in the registry and the number of categories in the registry is less than the registry capacity. Return the address of the (possibly newly-created) non-modifiable category having categoryName, if such a category exists, and the address of the non-modifiable Default Category otherwise. The behavior is undefined unless categoryName is null-terminated. Note that a valid category address is always returned.

const Category* ball::LoggerManager::setCategory ( CategoryHolder categoryHolder,
const char *  categoryName 
)

Add to the category registry of this logger manager a new category having the specified categoryName and default threshold levels if categoryName is not present in the registry and the number of categories in the registry is less than the registry capacity. Return the address of the (possibly newly-created) non-modifiable category having categoryName, if such a category exists, and the address of the non-modifiable Default Category otherwise. If the specified categoryHolder is non-null, then also load into categoryHolder the returned category and its maximum level and link categoryHolder to the category if it has not yet been linked. The behavior is undefined unless categoryName is null-terminated. Note that a valid category address is always returned.

Category* ball::LoggerManager::setCategory ( const char *  categoryName,
int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)

Add to the category registry of this logger manager a new category having the specified categoryName and recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold levels, respectively, if (1) categoryName is not present in the registry, (2) the number of categories in the registry is less than the registry capacity, and (3) recordLevel, passLevel, triggerLevel, and triggerAllLevel are all within the range [0 .. 255]. If categoryName is already present and each threshold level is within the valid range then reset the threshold levels of categoryName to the specified values. Return the address of the (possibly newly-created) modifiable category having categoryName if categoryName was either created or its thresholds reset, and 0 otherwise. The behavior is undefined unless categoryName is null-terminated. Note that 0, and not the Default Category, is returned on failure.

void ball::LoggerManager::setMaxNumCategories ( int  length  ) 

Set the capacity of the category registry of this logger manager to the specified length. If length is 0, no limit will be imposed. No categories are removed from the registry if the current number of categories exceeds length. However, subsequent attempts to add categories to the registry will fail. The behavior is undefined unless 0 <= length.

void ball::LoggerManager::deregisterAllObservers (  ) 

Remove all observers from the registry of observers maintained by this logger manager.

int ball::LoggerManager::deregisterObserver ( const bsl::string_view &  observerName  ) 

Remove the observer having the specified observerName from the registry of observers maintained by this logger manager. Return 0 if the observer having observerName was successfully deregistered from this logger manager, and a non-zero value (with no effect) otherwise. Henceforth, the observer that had observerName will no longer receive log records published by this logger manager.

int ball::LoggerManager::deregisterAttributeCollector ( const bsl::string_view &  collectorName  ) 

Remove the attribute collector having the specified collectorName from the registry of collectors maintained by this logger manager. Return 0 if the collector having collectorName was successfully deregistered from this logger manager, and a non-zero value (with no effect) otherwise.

bsl::shared_ptr<Observer> ball::LoggerManager::findObserver ( const bsl::string_view &  observerName  ) 

Return a shared pointer to the observer having the specified observerName in the registry of this logger manager, and an empty shared pointer if there is no such observer otherwise.

template<class t_OBSERVER >
int ball::LoggerManager::findObserver ( bsl::shared_ptr< t_OBSERVER > *  result,
const bsl::string_view &  observerName 
)

Load into the specified result a shared pointer to the observer of (template parameter) t_OBSERVER type having the specified observerName in the registry of this logger manager, and an empty shared pointer if there is no such observer otherwise. Return 0 if a non-empty shared pointer was loaded, and a non-zero value otherwise. Note that an empty shared pointer will be loaded if either no observer having observerName is in the registry or the observer registered with that name is not of t_OBSERVER type.

Observer* ball::LoggerManager::observer (  ) 

Return the address of the modifiable legacy observer registered with this logger manager.

DEPRECATED: Use findObserver instead.

int ball::LoggerManager::registerObserver ( const bsl::shared_ptr< Observer > &  observer,
const bsl::string_view &  observerName 
)

Add the specified observer with the specified observerName to the registry of observers maintained by this logger manager. Return 0 if observer was successfully registered with this logger manager, and a non-zero value (with no effect) otherwise. Henceforth, all log records published by this logger manager are published to this observer, until observer is deregistered. The behavior is undefined if a cyclic reference is created among registered observers. Note that this method will fail if an observer having observerName is already registered.

int ball::LoggerManager::registerAttributeCollector ( const AttributeCollector collector,
const bsl::string_view &  collectorName 
)

Add the specified collector with the specified collectorName to the registry of attribute collectors maintained by this logger manager. Return 0 if collector was successfully registered with this logger manager, and a non-zero value (with no effect) otherwise. Note that this method will fail if a collector having collectorName is already registered.

void ball::LoggerManager::resetDefaultThresholdLevels (  ) 

Reset the default threshold levels of this logger manager to the original "factory-supplied" default values or the factory overrides supplied at construction.

void ball::LoggerManager::setCategoryThresholdsToCurrentDefaults ( Category category  ) 

Set the threshold levels of the specified category in the category registry of this logger manager to the current default threshold values. The behavior is undefined unless category is non-null.

void ball::LoggerManager::setCategoryThresholdsToFactoryDefaults ( Category category  ) 

Set the threshold levels of the specified category in the category registry of this logger manager to the original "factory-supplied" default values or the factory overrides supplied at construction. The behavior is undefined unless category is non-null.

int ball::LoggerManager::setDefaultThresholdLevels ( int  recordLevel,
int  passLevel,
int  triggerLevel,
int  triggerAllLevel 
)

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

void ball::LoggerManager::setDefaultThresholdLevelsCallback ( DefaultThresholdLevelsCallback callback  ) 

Set the default-thresholds callback of this logger manager to the specified callback. The default-thresholds callback is used to determine default threshold levels for categories added to the registry by the setCategory(const char *) method.

int ball::LoggerManager::addRule ( const Rule value  ) 

Add a rule having the specified value to the set of (unique) rules maintained by this object. Return the number of rules added (i.e., 1 on success and 0 if a rule with the same value is already present).

int ball::LoggerManager::addRules ( const RuleSet ruleSet  ) 

Add each rule in the specified ruleSet to the set of (unique) rules maintained by this object. Return the number of rules added. Note that each rule having the same value as an existing rule will be ignored.

void ball::LoggerManager::removeAllRules (  ) 

Remove every rule from the set of rules maintained by this object.

int ball::LoggerManager::removeRule ( const Rule value  ) 

Remove the rule having the specified value from this set of rules maintained by this object. Return the number of rules removed (i.e., 1 on success and 0 if no rule having the same value is found.)

int ball::LoggerManager::removeRules ( const RuleSet ruleSet  ) 

Remove each rule in the specified ruleSet from this set of rules maintained by this object. Return the number of rules removed.

void ball::LoggerManager::publishAll (  ) 

Transmit to the observers registered with this logger manager all log records accumulated in the record buffers of all loggers managed by this logger manager, and indicate the publication cause to be MANUAL_PUBLISH_ALL.

template<class t_CATEGORY_VISITOR >
void ball::LoggerManager::visitCategories ( const t_CATEGORY_VISITOR &  visitor  ) 

Invoke the specified visitor functor on each category managed by this object, providing that functor modifiable access to each category. visitor must be a functor that can be called as if it had the following signature:

          void operator()(Category *);
template<class t_OBSERVER_VISITOR >
void ball::LoggerManager::visitObservers ( BSLS_COMPILERFEATURES_FORWARD_REF(t_OBSERVER_VISITOR)  visitor  ) 

Invoke the specified visitor functor of (template parameter) t_OBSERVER_VISITOR type on each element in the registry of this logger manager, supplying that functor modifiable access to each observer. visitor must be a functor that can be called as if it had the following signature:

          void operator()(const bsl::shared_ptr<Observer>& observer,
                          const bsl::string_view&          observerName);
bslma::Allocator* ball::LoggerManager::allocator (  )  const

Return the address of the modifiable allocator held by this logger manager.

const Category& ball::LoggerManager::defaultCategory (  )  const

Return a const reference to the Default Category in the category registry of this logger manager.

int ball::LoggerManager::defaultPassThresholdLevel (  )  const

Return the default pass threshold level of this logger manager.

int ball::LoggerManager::defaultRecordThresholdLevel (  )  const

Return the default record threshold level of this logger manager.

int ball::LoggerManager::defaultTriggerAllThresholdLevel (  )  const

Return the default trigger-all threshold level of this logger manager.

int ball::LoggerManager::defaultTriggerThresholdLevel (  )  const

Return the default trigger threshold level of this logger manager.

bsl::shared_ptr<const Observer> ball::LoggerManager::findObserver ( const bsl::string_view &  observerName  )  const

Return a shared pointer to the observer having the specified observerName in the registry of this logger manager, and an empty shared pointer if there is no such observer otherwise.

template<class t_OBSERVER >
int ball::LoggerManager::findObserver ( bsl::shared_ptr< const t_OBSERVER > *  result,
const bsl::string_view &  observerName 
) const

Load into the specified result a shared pointer to the observer of (template parameter) t_OBSERVER type having the specified observerName in the registry of this logger manager, and an empty shared pointer if there is no such observer otherwise. Return 0 if a non-empty shared pointer was loaded, and a non-zero value otherwise. Note that an empty shared pointer will be loaded if either no observer having observerName is in the registry or the observer registered with that name is not of t_OBSERVER type.

bool ball::LoggerManager::isCategoryEnabled ( const Category category,
int  severity 
) const

Return true if the specified severity is more severe (i.e., is numerically less than) at least one of the threshold levels of the specified category, and false otherwise. If the returned value is false, then a subsequent call to getLogger().logMessage() (with category and severity) will have no effect. This method compares severity with the threshold levels determined by combining category->thresholdLevels() with the thresholds provided by any relevant and active logging rules (in ruleSet()) that apply to category. Note that a rule applies to category if the rule's pattern matches category->categoryName(), and a rule is active if all the predicates defined for that rule are satisfied by the current thread's attributes (i.e., Rule::evaluate() returns true for the collection of attributes maintained by the current thread's AttributeContext object).

const Category* ball::LoggerManager::lookupCategory ( const char *  categoryName  )  const

Return the address of the non-modifiable category in the category registry of this logger manager having the specified categoryName, or 0 if no such category exists. The behavior is undefined unless categoryName is null-terminated.

int ball::LoggerManager::maxNumCategories (  )  const

Return the current capacity of the category registry of this logger manager. A capacity of 0 implies that no limit will be imposed; otherwise, new categories may be added only if numCategories() < maxNumCategories(). Note that 0 < maxNumCategories() < numCategories() is a valid state, implying no new categories may be added.

int ball::LoggerManager::numCategories (  )  const

Return the number of categories in the category registry of this logger manager.

const Observer* ball::LoggerManager::observer (  )  const

Return the address of the non-modifiable observer registered with this logger manager.

DEPRECATED: Use findObserver instead.

const RuleSet& ball::LoggerManager::ruleSet (  )  const

Return a const reference to the rule set maintained by this object.

const UserFieldsPopulatorCallback* ball::LoggerManager::userFieldsPopulatorCallback (  )  const

Return the address of the non-modifiable user populator functor registered with this logger manager, or 0 if there is no registered user populator functor.

template<class t_CATEGORY_VISITOR >
void ball::LoggerManager::visitCategories ( const t_CATEGORY_VISITOR &  visitor  )  const

Invoke the specified visitor functor on each category managed by this object, providing that functor non-modifiable access to each category. visitor must be a functor that can be called as if it had the following signature:

          void operator()(const Category *);
template<class t_OBSERVER_VISITOR >
void ball::LoggerManager::visitObservers ( BSLS_COMPILERFEATURES_FORWARD_REF(t_OBSERVER_VISITOR)  visitor  )  const

Invoke the specified visitor functor of (template parameter) t_OBSERVER_VISITOR type on each element in the registry of this logger manager, supplying that functor modifiable access to each observer. visitor must be a functor that can be called as if it had the following signature:

          void operator()(const bsl::shared_ptr<Observer>& observer,
                          const bsl::string_view&          observerName);
const ThresholdAggregate& ball::LoggerManager::defaultThresholdLevels (  )  const

Return the default threshold levels associated with this logger manager object.

int ball::LoggerManager::thresholdLevelsForNewCategory ( ThresholdAggregate levels,
const char *  categoryName 
) const

Load into the specified *levels the threshold levels that would be set for a newly created category, irrespective of whether a category with the specified categoryName is already in the registry. Return 0 on success and a non-zero value otherwise. If the client has configured a default threshold levels callback (see ball::LoggerManager::DefaultThresholdLevelsCallback in the component doc), the categoryName will be supplied to that callback which will set *levels. Otherwise, if no default threshold levels callback has been provided, the default threshold levels are used. Note that this function will report an error if the callback returns invalid levels. Also note that if a category named categoryName is already in the registry, the levels returned by this method may differ from the levels of that category.


Friends And Related Function Documentation

friend class LoggerManagerCategoryIter [friend]
friend class LoggerManagerCategoryManip [friend]

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