BloombergLP::ball::AsyncFileObserver

Asynchronous observer that publishes log records to stdout and a file.

Synopsis

Declared in <ball_asyncfileobserver.h>

class AsyncFileObserver
    : public Observer

Description

This class implements the Observer protocol. The publish method of this class outputs log records asynchronously to stdout and optionally to a user-specified file. This class is thread-safe; different threads can operate on an object concurrently. This class is exception-neutral with no guarantee of rollback. In no event is memory leaked.

Base Classes

NameDescription
ObserverThis class provides a protocol for receiving and processing log record output.

Type Aliases

NameDescription
OnFileRotationCallback Alias for a user-supplied callback invoked after log file rotation.

Member Functions

NameDescription
AsyncFileObserver [constructor]Constructors
~AsyncFileObserver [destructor] [virtual]Destroy this observer after draining and stopping publication.
disableFileLogging Disable file logging for this async file observer.
disablePublishInLocalTime Disable publishing of record timestamps in local time.
disableSizeRotation Disable log file rotation based on log file size for this async file observer. This method has no effect if rotation-on-size is not enabled.
disableStdoutLoggingPrefix Disable the long output format when logging to stdout.
disableTimeIntervalRotation Disable log file rotation based on a periodic time interval for this async file observer. This method has no effect if rotation-on-time-interval is not enabled.
enableFileLogging Enable file logging using a name derived from logFilenamePattern.
enablePublishInLocalTime Enable publishing of record timestamps in local time.
enableStdoutLoggingPrefix Enable the long output format when logging to stdout.
forceRotation Force an immediate log file rotation by this observer.
getFileLogFormat Return the format specification used for log-file records.
getLogFormat Load the log-file and stdout format specifications.
getStdoutLogFormat Return the format specification used for stdout log records.
isFileLoggingEnabled isFileLoggingEnabled overloads
isPublicationThreadRunning Return true if a publication thread is currently running.
isPublishInLocalTimeEnabled Return true if published timestamps are written in local time.
isStdoutLoggingPrefixEnabled Return true if the long stdout output format is in use.
isSuppressUniqueFileNameOnRotation Return true if the log filename uniqueness check on rotation is suppressed, and false otherwise.
isUserFieldsLoggingEnabled [deprecated]Return true if the logging of user-defined fields is enabled for this async file observer, and false otherwise.
localTimeOffset Return the local-minus-UTC offset captured at construction.
publish publish overloads
recordQueueLength Return the number of log records currently on the record queue of this async file observer.
releaseRecords [virtual]Discard shared references to Record objects held by this observer.
rotateOnSize Rotate the log file when its size exceeds the specified size.
rotateOnTimeInterval rotateOnTimeInterval overloads
rotationLifetime Return the log file lifetime that triggers rotation, or zero.
rotationSize Return the size (in kilobytes) of the log file that will trigger a file rotation by this async file observer if rotation-on-size is in effect, and 0 otherwise.
setFileLogFormat Set the format specification for log records written to the log file.
setLogFormat Same as setLogFormats.
setLogFormats Set the format specifications for log-file and stdout records.
setOnFileRotationCallback Set the callback invoked after each log file rotation attempt.
setStdoutLogFormat Set the format specification for log records written to stdout.
setStdoutThreshold Set the minimum severity of records logged to stdout.
shutdownPublicationThread Stop the publication thread without draining the record queue.
startPublicationThread Start a thread that asynchronously publishes queued log records.
stdoutThreshold Return the minimum severity of records logged to stdout.
stopPublicationThread Drain the record queue, then stop the publication thread.
suppressUniqueFileNameOnRotation Suppress or enable unique filenames when rotating the log file.
operator BloombergLP::bslmf::NestedTraitDeclaration<AsyncFileObserver, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Using Declarations

NameDescription
publish Import the base-class publish overloads.