BloombergLP::ball::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.

Synopsis

Declared in <ball_recordstringformatter.h>

class RecordStringFormatter;

Type Aliases

NameDescription
allocator_type This typedef is an alias for the allocator used by this object.

Member Functions

NameDescription
RecordStringFormatter [constructor]Constructors
operator= Assign to this record formatter the value of the specified rhs record formatter.
disablePublishInLocalTime Disable adjust of the timestamp attribute of to the current local time by this file observer. This method has no effect if adjustment to the current local time is not enabled.
enablePublishInLocalTime Enable adjustment of the timestamp attribute to the current local time. This method has no effect if adjustment to the current local time is already enabled.
format Return the format specification of this record formatter.
get_allocator Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used.
isPublishInLocalTimeEnabled Return true if this formatter adjusts the timestamp attribute to the current local time, and false otherwise.
operator() Format the specified record according to the format specification of this record formatter and output the result to the specified stream. The timestamp offset of this record formatter is added to each timestamp that is output to stream.
setFormat Set the format specification of this record formatter to the specified format.
setTimestampOffset Set the timestamp offset of this record formatter to the specified offset.
timestampOffset Return a reference to the non-modifiable timestamp offset of this record formatter.
operator BloombergLP::bslmf::NestedTraitDeclaration<RecordStringFormatter, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Static Member Functions

NameDescription
loadTextSchemeFormatter This class method configures a formatter for the "text" scheme using the specified format and formatOptions and if successful loads it into the specified output and returns zero. In case configuration fails a non-zero value is returned and output is loaded with a string formatter of the default format configuration ` "n%d %p:%t %s %f:%l %c %m %un" `

Static Data Members

NameDescription
k_BASIC_ATTRIBUTE_FORMAT A simple standard record format that renders ball::Attribute values in the formatted output. Note that this format is recommended over the default format, k_DEFAULT_FORMAT, for most applications (the default format is currently maintained for backwards compatibility).
k_DEFAULT_FORMAT The default log format specification used by RecordStringFormatter.

Non-Member Functions

NameDescription
operator!=Return true if the specified lhs and rhs record formatters do not have the same value, and false otherwise. Two record formatters differ in value if their format specifications differ or their timestamp offsets differ.
operator==Return true if the specified lhs and rhs record formatters have the same value, and false otherwise. Two record formatters have the same value if they have the same format specification and the same timestamp offset.