|
BDE 4.14.0 Production release
|
#include <ball_recordattributes.h>
Public Member Functions | |
| BSLMF_NESTED_TRAIT_DECLARATION (RecordAttributes, bslma::UsesBslmaAllocator) | |
| RecordAttributes (bslma::Allocator *basicAllocator=0) | |
| RecordAttributes (const bdlt::Datetime ×tamp, int processID, bsls::Types::Uint64 threadID, const char *fileName, int lineNumber, const char *category, int severity, const char *message, bslma::Allocator *basicAllocator=0) | |
| RecordAttributes (const RecordAttributes &original, bslma::Allocator *basicAllocator=0) | |
| ~RecordAttributes ()=default | |
| Destroy this object. | |
| RecordAttributes & | operator= (const RecordAttributes &rhs) |
| void | clearMessage () |
| bdlsb::MemOutStreamBuf & | messageStreamBuf () |
| bsl::ostream & | messageStream () |
| void | setCategory (const char *category) |
| void | setFileName (const char *fileName) |
| void | setLineNumber (int lineNumber) |
| void | setMessage (const char *message) |
| void | setProcessID (int processID) |
| void | setSeverity (int severity) |
| void | setThreadID (bsls::Types::Uint64 threadID) |
| void | setTimestamp (const bdlt::Datetime ×tamp) |
| const char * | category () const |
| Return the category attribute of this record attributes object. | |
| const char * | fileName () const |
| Return the filename attribute of this record attributes object. | |
| int | lineNumber () const |
| Return the line number attribute of this record attributes object. | |
| const char * | message () const |
| bslstl::StringRef | messageRef () const |
| int | processID () const |
| Return the processID attribute of this record attributes object. | |
| int | severity () const |
| Return the severity attribute of this record attributes object. | |
| bsls::Types::Uint64 | threadID () const |
| Return the threadID attribute of this record attributes object. | |
| const bdlt::Datetime & | timestamp () const |
| Return the timestamp attribute of this record attributes object. | |
| const bdlsb::MemOutStreamBuf & | messageStreamBuf () const |
| const bsl::ostream & | messageStream () const |
| bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Friends | |
| bool | operator== (const RecordAttributes &, const 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).
Additionally, this class supports a complete set of value semantic operations, including copy construction, assignment and equality comparison, and ostream printing. A precise operational definition of when two instances have the same value can be found in the description of operator== for the class. This class is exception neutral with no guarantee of rollback: If an exception is thrown during the invocation of a method on a pre-existing instance, the object is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.
|
explicit |
Create a record attributes object with all attributes having default values. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
| ball::RecordAttributes::RecordAttributes | ( | const bdlt::Datetime & | timestamp, |
| int | processID, | ||
| bsls::Types::Uint64 | threadID, | ||
| const char * | fileName, | ||
| int | lineNumber, | ||
| const char * | category, | ||
| int | severity, | ||
| const char * | message, | ||
| bslma::Allocator * | basicAllocator = 0 |
||
| ) |
Create a record attributes object having the specified timestamp, processID, threadID, fileName, lineNumber, category, severity and message values, respectively. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The behavior is undefined if any const char * argument is null.
| ball::RecordAttributes::RecordAttributes | ( | const RecordAttributes & | original, |
| bslma::Allocator * | basicAllocator = 0 |
||
| ) |
Create a record attributes object having the value of the specified original record attributes object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
|
default |
| ball::RecordAttributes::BSLMF_NESTED_TRAIT_DECLARATION | ( | RecordAttributes | , |
| bslma::UsesBslmaAllocator | |||
| ) |
|
inline |
|
inline |
Set the message attribute of this record attributes object to the empty string. Resets the objects returned by the messageStreamBuf and messageStream methods.
|
inline |
|
inline |
| const char * ball::RecordAttributes::message | ( | ) | const |
Return the message attribute of this record attributes object. Note that this method will return a truncated message if it contains embedded null ('\0') characters; see messageRef for an alternative to this method. Warning: This method is not const thread-safe, and cannot be safely called concurrently. It may modify the stream buffer returned by messageStreamBuf.
| bslstl::StringRef ball::RecordAttributes::messageRef | ( | ) | const |
Return a string reference providing non-modifiable access to the message attribute of this record attributes object. Note that the returned string reference is not null-terminated, and may contain null ('\0') characters.
|
inline |
Return a reference to the modifiable stream associated with the message attribute of this record attributes object.
|
inline |
Return a reference to the non-modifiable stream associated with the message attribute of this record attributes object.
|
inline |
Return a reference to the modifiable stream buffer associated with the message attribute of this record attributes object.
|
inline |
Return a reference to the non-modifiable stream buffer associated with the message attribute of this record attributes object.
| RecordAttributes & ball::RecordAttributes::operator= | ( | const RecordAttributes & | rhs | ) |
Assign to this record attributes object the value of the specified rhs record attributes object. Resets the objects returned by the messageStreamBuf and messageStream methods.
| bsl::ostream & ball::RecordAttributes::print | ( | bsl::ostream & | stream, |
| int | level = 0, |
||
| int | spacesPerLevel = 4 |
||
| ) | const |
Format this object to the specified output stream at the optionally specified indentation level and return a reference to the modifiable stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. Each line is indented by the absolute value of level * spacesPerLevel. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, suppress line breaks and format the entire output on one line. If stream is initially invalid, this operation has no effect.
|
inline |
|
inline |
Set the category attribute of this record attributes object to the specified (non-null) category.
|
inline |
Set the filename attribute of this record attributes object to the specified (non-null) fileName.
|
inline |
Set the line number attribute of this record attributes object to the specified lineNumber.
| void ball::RecordAttributes::setMessage | ( | const char * | message | ) |
Set the message attribute of this record attributes object to the specified (non-null) message. Resets the objects returned by the messageStreamBuf and messageStream methods.
|
inline |
Set the processID attribute of this record attributes object to the specified processID.
|
inline |
Set the severity attribute of this record attributes object to the specified severity.
|
inline |
Set the threadID attribute of this record attributes object to the specified threadID.
|
inline |
Set the timestamp attribute of this record attributes object to the specified timestamp.
|
inline |
|
inline |
|
inline |
|
friend |
Return true if the specified lhs and rhs record attributes objects have the same value, and false otherwise. Two record attributes objects have the same value if each respective pair of attributes have the same value.