Provide a container for the fields and attributes of a log record.
More...
Namespaces |
namespace | ball |
Detailed Description
- Outline
-
-
- Purpose:
- Provide a container for the fields and attributes of a log record.
-
- Classes:
ball::Record | container for a log record's fields and attributes |
- See also:
- Component ball_recordattributes, ball_logger
-
- Description:
- This component provides a single, unconstrained (value-semantic) attribute class,
ball::Record
, that is used to describe the properties of a logged message.
-
- Attributes:
-
-
fixedFields
: mandatory log fields including timestamp, location, severity, process id, and the log message.
-
userFields
: user-managed fields associated with a log record. Note that use of these fields is deprecated and superseded by attributes
.
-
attributes
: user-managed name/value pairs associated with a log record.
ball::Record
aggregates a set of fixed fields and various user-defined fields and attributes into one record type, useful for transmitting a customized log record as a single instance rather than passing around individual attributes separately. Note that this class is a pure attribute class with no constraints, other than the total memory required for the class. Also note that this class is not thread-safe.
-
- Usage:
- This section illustrates intended use of this component.
-
- Example 1: Basic Use of ball::Record:
- The following example demonstrates how to create and set the properties of a
ball::Record
. Note that users of the ball
logging subsystem are not expected to create records directly.
- First we default create a
ball::Record
, record
, and verify it has a default set of attributes: Then, we set the fixed fields of the record to contain a simple message: Next, we add an additional attribute to the log record: Finally, we write the record to a stream: