BloombergLP::ball

Package namespace for logging components.

Types

NameDescription
Administration This struct provides a namespace for a suite of utility functions that simplifies administration of the ball logging subsystem, and insulates administrative clients from changes to lower-level components of the ball package. A precondition common to all of the utility functions is that the logger manager singleton must be initialized and not in the process of being shut down.
AsyncFileObserver This class implements the Observer protocol. The publish method of this class outputs log records asynchronously to stdout and optionally to a user-specified file. This class is thread-safe; different threads can operate on an object concurrently. This class is exception-neutral with no guarantee of rollback. In no event is memory leaked.
AsyncFileObserver_Record PRIVATE STRUCT. For use by the ball::AsyncFileObserver implementation only. This struct holds a log record and its associated context.
Attribute An Attribute object contains an attribute name which is not managed and an attribute value which is managed.
AttributeCollectorRegistry This component maintains a registry of named functors ("collectors") that are used to transform opaque user data into a set of ball::Attribute objects.
AttributeContainer This class defines a protocol for a container of attribute values. The attribute container provides a hasValue() method to determine whether an attribute value is in the container.
AttributeContainerList This class provides an in-core value-semantic list of AttributeContainer object addresses. Attribute container addresses are added to this list using pushFront(), which returns an iterator located at the new element. A AttributeContainerList::iterator object remains valid until the element referred to by the iterator is removed. Attribute container addresses can be removed using either remove(), removeAll(), or removeAllAndRelease(). This list object attempts to minimize the number of memory allocations it requires by placing the memory for elements that have been released in a free memory store, and re-using the memory when new elements are added. The removeAll() removes all the elements from the list, but does not release any allocated memory (placing it in the free store). The removeAllAndRelease() operation removes all elements and releases all allocated memory. Note that maintaining a free store is important for this component because the expectation is that elements will be both added and removed frequently.
AttributeContainerListIterator This class provides an STL-style iterator over a sequence of AttributeContainer object addresses. The behavior of the operator* method is undefined unless the iterator is at a valid position in the sequence of AttributeContainer object addresses (i.e., not the "end") and the referenced element has not been removed since the iterator was constructed.
AttributeContainerList_Node This is an implementation type of AttributeContainerList and should not be used by clients of this package. A AttributeContainerList_Node represents a node in a AttributeContainerList object.
AttributeContext This class provides a mechanism for associating attributes with the current thread, and evaluating the logging rules associated with a category using those stored attributes. AttributeContext contains class data members that must be initialized (using the initialize class method) with a CategoryManager object containing a RuleSet that represents the currently installed logging rules for the process. Clients can obtain the context for the current thread by calling the getContext class method. The addAttributes and removeAttributes methods are used to add and remove collections of attributes from the (thread-local) context object. Finally, AttributeContext provides methods (used primarily by other components in the ball package') to determine the effect of the current logging rules on the logging thresholds of a category. The hasRelevantActiveRules method returns true if there are any relevant and active rules that might modify the logging thresholds of the supplied category. A rule is "relevant" if the rule's pattern matches the category's name, and a rule is "active" if all the attributes defined for the rule are satisfied by the current thread's attributes (i.e., Rule::evaluate returns true for the collection of attributes maintained for the current thread by the thread's AttributeContext object). The determineThresholdLevels method returns the logging threshold levels for a category, factoring in any active rules that apply to the category that might override the category's thresholds. The behavior for the hasRelevantActiveRules and determineThresholdLevels methods is undefined unless initialize has been called. Note that, in practice, initialize is called internally when the logger manager singleton is initialized; clients ordinarily should not call initialize directly.
AttributeContextProctor This class implements a proctor that, on its own destruction, will destroy the attribute context of the current thread. Attribute contexts are stored in thread-local memory. On destruction, objects of this type will deallocate the current thread's attribute context (if one has been created), and set the thread-local storage pointer to 0.
AttributeContext_RuleEvaluationCache This is an implementation type of AttributeContext and should not be used by clients of this package. A rule evaluation cache is a mechanism for evaluating and caching whether a rule is active. A rule is considered active if all of its attributes are satisfied by the collection of attributes held in a AttributeContainerList object (i.e., Rule::evaluate returns true for the AttributeContainerList object). The rules this cache evaluates are contained in a RuleSet object. RuleSet::MaskType is a bit mask for a rule set, where each bit is a boolean value associated with the rule at the corresponding index in a rule set. An AttributeContext determines, using the isDataAvailable method, if a particular set of rules (described using a bit mask) have already been evaluated. A context accesses the current cache of rule evaluations using the knownActiveRules method. Finally, a context updates the cache of rule evaluations using the update method. Note that the isDataAvailable method should be used prior to using knownActiveRules in order to ensure the relevant rules have been evaluated and that those evaluations are up-to-date.
BroadcastObserver This class provides a broadcasting implementation of the Observer protocol. Other concrete observers may be registered and named with this broadcast observer (registerObserver method), retrieved (findObserver method), and unregistered (deregisterObserver method). The publish method of this class forwards the log records that it receives to the publish method of each registered observer.
Category 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].
CategoryCallbacks This struct provides a namespace for default threshold level related callback function types.
CategoryHolder This class, informally referred to as a "category holder" (or simply "holder"), holds a category, a threshold level, and a pointer to a "next" holder. Both the category and next pointer may be null. The intended use is as follows: (1) instances of this class are (only) declared in contexts where logging occurs; (2) if the held category is non-null, then the held threshold is the numerical maximum of the four levels of that category; (3) if the next pointer is non-null, then the holder pointed to holds the same category and threshold. Instances of this class must be statically initializable. Hence, the data members are public, and automatically generated constructors and destructor are used.
CategoryManager This class manages a set (or "registry") of categories. Categories may be added to the registry, but they cannot be removed. However, the threshold levels of existing categories may be accessed and modified directly.
CategoryManagerImpUtil This class provides a suite of free functions used to help implement a manager of categories and category holders.
CategoryManagerIter This class defines an iterator providing sequential, read-only access to the categories in the registry of a category manager. The order of the iteration is undefined.
CategoryManagerManip This class defines an iterator providing sequential, modifiable access to the categories in the registry of a category manager. The order of the iteration is undefined.
CategoryManager_RadixTree This class template implements a space-efficient associative container that maps string keys to values of the specified t_VALUE type. The container uses a radix tree (compressed trie) data structure, which shares common prefixes among keys. The container provides O(k) insertion, lookup, and removal operations, where k is the key length.
CategoryManager_RadixTree_ChildNodeGuard RAII guard to remove a child node when an exception is thrown during value emplacement in a CategoryManager_RadixTree_Node. This guard ensures exception safety by automatically removing a newly created child node from its parent if the value construction throws an exception.
CategoryManager_RadixTree_Node This class template represents a node in the radix tree. Each node stores a prefix string, an optional value, and child nodes mapped with their prefix-part starting character. As the second underscore in the class name indicates, this is a component-local class not intended for use outside of
Context This class provides a container for aggregating the auxiliary information needed to transmit a log record. For each context attribute in this class (e.g., recordIndex), there is an accessor for obtaining the attribute's value (recordIndex) and there are manipulators for changing the contained attribute values (setAttributes checks attribute constraints; setAttributesRaw and setRecordIndexRaw do not). A static isValid method is also provided to verify that particular attribute values are consistent before they are used to create or modify a context object. Note that it is the client's responsibility not to construct or unilaterally modify a context object to hold incompatible attribute values.
CountingAllocator This class maintains a count of the total number of allocated bytes. The running byte count is initialized to 0 upon construction, is increased by the allocate method, and may be reset to 0 by the resetNumBytesTotal method. The deallocate method appropriately decrement the byte count. The precise definition of byte count is described in the "Byte Count" section of the component-level documentation.
CstdioObserver This class provides a concrete implementation of the Observer protocol. The publish method of this class outputs the log records that it receives to a FILE * supplied at construction and then flushes the stream.
DefaultAttributeContainer A DefaultAttributeContainer object contains a collection of (unique) attributes values.
FileObserver This class implements the Observer protocol. The publish method of this class outputs the log records that it receives to stdout and optionally to a user-specified file. This class is thread-safe; different threads can operate on an object concurrently. This class is exception-neutral with no guarantee of rollback. In no event is memory leaked.
FileObserver2 This class implements the Observer protocol. The publish method of this class outputs the log records that it receives to a user-specified file. This class is thread-safe; different threads can operate on an object concurrently. This class is exception-neutral with no guarantee of rollback. In no event is memory leaked.
FilteringObserver This class provides a concrete implementation of the Observer protocol that filters the Record and Context objects passed to its publish method based on a callback (function or functor) supplied at construction. The callback must be convertible to: ` bsl::function<bool(const Record&, const Context&)> ` If the callback returns true for the Record and Context, then they are forwarded to the publish method of an observer also supplied at construction. If the callback returns false, then the Record and Context are ignored (i.e., they are filtered out by this observer).
FixedSizeRecordBuffer This class provides a concrete, thread-safe implementation of the RecordBuffer protocol. This class is a mechanism. At any time, the sum of sizes of all records contained in a FixedSizeRecordBuffer object plus the amount of memory allocated by the FixedSizeRecordBuffer object itself is guaranteed to be less than or equal to an upper bound specified at creation. The class is thread-safe, except that the methods front and back must be called after locking the buffer by invoking beginSequence. In order to accommodate a pushBack request, the records from the front end of the buffer may be removed. Similarly, in order to accommodate a pushFront request, the records from the back end of the buffer may be removed. If a record can not accommodate in the buffer, it is silently (but otherwise safely) discarded.
HierarchicalCategorySetting This class represents a hierarchical category setting that consists of a category name prefix and 4 threshold level settings for categories whose name starts with that prefix. Instances of HierarchicalCategorySetting are created and manipulated by LoggerManager. All threshold levels are integral values in the range [0 .. 255].
Log This struct provides a namespace for a suite of utility functions that simplify usage of the ball_loggermanager component. The direct use of these utility functions is strongly discouraged.
LogFileCleanerUtil This utility class provides functions for converting log file patterns and for cleaning up log files based on a configuration.
Log_Formatter This class provides an aggregate of several objects relevant to the logging of a message via the printf-style macros: ` - record to be logged - category to which to log the record - severity at which to log the record - buffer in which the user log message is formatted ` As a side-effect of creating an object of this class, the record is constructed, and the buffer is obtained. As a side-effect of destroying the object, the record is formatted, using the buffer, and logged.
Log_Stream This class provides an aggregate of several objects relevant to the logging of a message via the C++ stream-based macros: ` - record to be logged - category to which to log the record - severity at which to log the record - stream to which the user log message is put ` As a side-effect of creating an object of this class, the record and stream are also constructed. As a side-effect of destroying the object, the record is logged.
Logger This class provides log record management services. Each instance of Logger receives log records from one or more clients, manages the storage of those records, and transmits them to a registered recipient (i.e., an observer) when appropriate.
LoggerCategoryUtil This struct provides a suite of utility functions that facilitate the management of the categories in LoggerManager.
LoggerFunctorPayloads This struct provides a namespace for a suite of utility functions, each of which may be used as the function body for an appropriate bsl::function callback functor within ball_loggermanager.
LoggerManager 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.
LoggerManagerCategoryIter This class defines an iterator providing sequential, read-only access to the categories in the registry of a logger manager's category manager. The order of the iteration is undefined.
LoggerManagerCategoryManip This class defines an iterator providing sequential, modifiable access to the categories in the registry of a logger manager's category manager. The order of the iteration is undefined.
LoggerManagerConfiguration This class provides constrained configuration parameters for a logger manager. The constraints are maintained as class invariants; it is not possible to obtain an invalid object through this interface.
LoggerManagerDefaults This class provides constrained configuration parameters for a logger manager. The constraints are maintained as class invariants; it is not possible to obtain an invalid object through this interface.
LoggerManagerScopedGuard This class implements a scoped guard that, on construction, creates the logger manager singleton, and, on destruction, destroys the singleton.
ManagedAttribute A ball::ManagedAttribute object contains a ball::Attribute object and provides storage for the attribute's name.
ManagedAttributeSet This class implements a value-semantic collection of unique attributes. (Note that an attribute is a compound entity that, as a whole, must be unique although individual parts need not be.) Additionally, the evaluate accessor can be used to determine if every attribute in the set is present in the specified attribute container list.
MultiplexObserver This class provides a multiplexing implementation of the Observer protocol. Other concrete observers may be registered with a multiplexing observer (registerObserver method) and later unregistered (deregisterObserver method). The publish method of this class forwards the log records that it receives to the publish method of each registered observer.
Observer This class provides a protocol for receiving and processing log record output.
ObserverAdapter This class aids in the implementation of the Observer protocol by allowing clients to implement that protocol by implementing a single method signature: publish(const Record&, const Context&).
ObserverFormatterImp This class provides a common implementation of formatting-related methods for observer components that support scheme-based log record formatting. It manages a log record formatter, format configuration strings, and time zone preferences. This implementation is intended to be used as a data member in concrete observer classes to provide consistent formatting behavior across different observer types.
PatternUtil This utility class provides functions relating to pattern matching for strings.
Record Forward declaration of the log record type published by observers.
RecordAttributes This class provides a container for a fixed set of attributes appropriate for logging. For each attribute in this class (e.g., category), there is an accessor for obtaining the attribute's value (the category accessor) and a manipulator for changing the attribute's value (the setCategory manipulator).
RecordBuffer Provide a protocol (or pure interface) for managing record handles (specifically instances of bsl::shared_ptr<Record>).
RecordFormatterFunctor This struct provides a namespace for a typedef of the functor used for formatting log records to a stream.
RecordFormatterOptions This class provides a value-semantic type for representing options used to configure log record formatters. These options are supplemental to the format specification string and affect how certain fields in log records are rendered. Currently, the only supported option is timezoneDefault, which controls whether timestamps are displayed in UTC or local time.
RecordFormatterRegistryUtil This utility provides a namespace for functions to create log record formatters based on URI-like scheme identifiers.
RecordFormatterTimezone This struct provides a namespace for enumerating timezone values for timestamps in record formatters.
RecordJsonFormatter This class provides a function object that formats a log record as JSON text elements and renders them to an output stream. The overloaded operator() provided by the class formats log record according to a message format specification supplied either by setJsonFormat or setSimplifiedFormat manipulator or the default format installed by the constructor) and outputs the result to the stream. While this functor type is designed to match the function signature expected by many concrete ball::Observer implementations that publish log records (for example, see ball::FileObserver2::setLogFileFunctor) it is advised to use the more flexible scheme-based format selection provided now by every BDE-made observer.
RecordJsonFormatter_FieldFormatter Forward declaration for a field formatter used by RecordJsonFormatter.
RecordStringFormatter This class provides a value-semantic log record formatter that holds a printf-style format specification and a timestamp offset. The overloaded operator() provided by the class formats a given record according to the format specification and outputs the formatted result to a given stream. The timestamp offset of the record formatter is added to each timestamp that is output to the stream.
Rule This class defines a value-semantic object that holds a pattern, four threshold levels, and an attribute set. For each of these fields there is an accessor for obtaining the field value and a manipulator for changing that value. There are a few methods as well for directly adding/removing/searching attributes.
RuleSet This class manages a set of unique rule values. Rules may be added to or removed from the set; however, rules having duplicate values will not be added. For the definition of two rules having the same value, please refer to the function-level documentation associated with the Rule::operator== function.
ScopedAttribute This class provides a scoped guard that sets a single BALL attribute in the current thread.
ScopedAttribute_Container This component-private class is a concrete implementation of the AttributeContainer protocol for a single attribute.
ScopedAttributes This class installs a AttributeContainer object in the current attribute context on construction, and removes it on destruction. Note that the AttributeContainer supplied at construction must remain valid and unmodified for the lifetime of this object.
Severity This struct provides a namespace for enumerating severity levels.
SeverityUtil This struct provides a namespace for non-primitive procedures on the Severity::Level enumeration.
StreamObserver This class provides a concrete implementation of the Observer protocol. The publish method of this class outputs the log records that it receives to an instance of bsl::ostream supplied at construction.
TestObserver This class provides an instrumented implementation of the Observer protocol suitable for testing systems that use Observer. Each instance receives a unique (per process) integer identifier at construction, and keeps count of the number of records that it has published, as well as the contents of the most recently published record and context.
ThresholdAggregate This class implements an aggregate of the four logging threshold levels.
ThresholdAggregateUtil This class provides helper methods for working with ball::ThresholdAggregate objects.
ThresholdDefaults This struct provides a namespace for default threshold level related constants.
Transmission This struct provides a namespace for enumerating the causes of the transmission of a log record.
UserFieldType This struct provides a namespace for enumerating month-of-year values. See Enum in the TYPES sub-section for details.
UserFieldValue This class implements a value-semantic type for representing the value of a user field in a log record. A user field value acts as a discriminated union, and may represent a value of any of the types described in ball::UserFieldType or an unset value (indicated by type ball::UserFieldType::e_VOID).
UserFields This class implements a value-semantic type for representing a sequence of (randomly accessible) user field values.

Type Aliases

NameDescription
Predicate DEPRECATED: Use ball::ManagedAttribute instead.
PredicateSet DEPRECATED: Use ball::ManagedAttributeSet instead.

Functions

NameDescription
ball_log_getCategoryHolder Return the address of the specified categoryHolder. Note that this function facilitates consistent lookup of block-scope and class-scope category holders (see "Logging Macro Reuse" in the "IMPLEMENTATION NOTES" of the component implementation file for details).
swap swap overloads
operator<< Stream insertion operators
operator== Equality operators
operator!= Inequality operators