|
BDE 4.39.x Production Release
|
#include <ball_recordstringformatter.h>
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.
Public Types | |
| typedef bsl::allocator< char > | allocator_type |
Static Public Member Functions | |
| static int | loadTextSchemeFormatter (RecordFormatterFunctor::Type *output, const bsl::string_view &format, const RecordFormatterOptions &formatOptions) |
Static Public Attributes | |
| static const char * | k_DEFAULT_FORMAT |
| static const char * | k_BASIC_ATTRIBUTE_FORMAT |
| typedef bsl::allocator<char> ball::RecordStringFormatter::allocator_type |
|
explicit |
Create a record formatter having a default format specification and a timestamp offset of 0. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory. If basicAllocator is not supplied or 0, the currently installed default allocator is used. The default format specification is:
|
explicit |
|
explicit |
Create a record formatter having the specified format specification and a timestamp offset of 0. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory. If basicAllocator is not supplied or 0, the currently installed default allocator is used.
| ball::RecordStringFormatter::RecordStringFormatter | ( | const char * | format, |
| bslma::Allocator * | basicAllocator | ||
| ) |
|
explicit |
|
explicit |
Create a record formatter having a default format specification and the specified timestamp offset. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used. The default format specification is:
publishInLocalTime instead.
|
explicit |
Create a record formatter having a default format specification, and if the specified publishInLocalTime flag is true, format the timestamp of each logged record in the local time of the current task, and format the timestamp in UTC otherwise. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used. The default format specification is:
| ball::RecordStringFormatter::RecordStringFormatter | ( | const char * | format, |
| const bdlt::DatetimeInterval & | offset, | ||
| const allocator_type & | allocator = allocator_type() |
||
| ) |
Create a record formatter having the specified format specification and the specified timestamp offset. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.
publishInLocalTime instead. | ball::RecordStringFormatter::RecordStringFormatter | ( | const char * | format, |
| bool | publishInLocalTime, | ||
| const allocator_type & | allocator = allocator_type() |
||
| ) |
Create a record formatter having the specified format specification, and if the specified publishInLocalTime flag is true, format the timestamp of each log in the local time of the current task, and format the timestamp in UTC otherwise. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.
| ball::RecordStringFormatter::RecordStringFormatter | ( | const RecordStringFormatter & | original, |
| const allocator_type & | allocator = allocator_type() |
||
| ) |
Create a record formatter initialized to the value of the specified original record formatter. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.
|
default |
Destroy this object.
| ball::RecordStringFormatter::BSLMF_NESTED_TRAIT_DECLARATION | ( | RecordStringFormatter | , |
| bslma::UsesBslmaAllocator | |||
| ) |
| void ball::RecordStringFormatter::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.
| void ball::RecordStringFormatter::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.
|
inline |
Return the format specification of this record formatter.
|
inline |
Return the allocator used by this object to supply memory.
| bool ball::RecordStringFormatter::isPublishInLocalTimeEnabled | ( | ) | const |
Return true if this formatter adjusts the timestamp attribute to the current local time, and false otherwise.
|
static |
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
| void ball::RecordStringFormatter::operator() | ( | bsl::ostream & | stream, |
| const Record & | record | ||
| ) | const |
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.
| RecordStringFormatter & ball::RecordStringFormatter::operator= | ( | const RecordStringFormatter & | rhs | ) |
Assign to this record formatter the value of the specified rhs record formatter.
|
inline |
Set the format specification of this record formatter to the specified format.
|
inline |
Set the timestamp offset of this record formatter to the specified offset.
|
inline |
Return a reference to the non-modifiable timestamp offset of this record formatter.
|
static |
A simple standard record format that renders ball::Attribute values in the formatted output.
k_DEFAULT_FORMAT, for most applications (the default format is currently maintained for backwards compatibility).
|
static |
The default log format specification used by RecordStringFormatter.