BDE 4.14.0 Production release
|
Provide a scoped guard for a single BALL attribute.
This component defines a type, ball::ScopedAttribute
, that serves as a scoped guard for ball::Attribute
objects. It defines a single attribute for the current thread while it is in scope.
This component is used to associate an attribute (a name-value pair) with the current thread context for use when writing log records for the current thread. This context information can both be written to the log itself, and used as input when evaluating whether a particular log should be written. For more information on how to use this feature, please see the package level documentation and usage examples for "Log Attributes" and "Rule-Based Logging".
This section illustrates intended use of this component.
Suppose that service requests for a fictional service with id 999
are handled asynchronously by the function below. Creating an instance of this class will set BALL attributes for any logging performed while the request is being processed:
Attribute "request" will be set in the calling thread and will affect publication of any BALL messages for the lifetime of attribute
.