[#BloombergLP-ball-AsyncFileObserver-2constructor-00] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::xref:BloombergLP/ball/AsyncFileObserver.adoc[AsyncFileObserver]::AsyncFileObserver :relfileprefix: ../../../ :mrdocs: Create an async file observer with queue capacity and drop threshold. == Synopsis Declared in `<ball_asyncfileobserver.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- AsyncFileObserver( xref:BloombergLP/ball/Severity/Level.adoc[Severity::Level] stdoutThreshold, bool publishInLocalTime, int maxRecordQueueSize, xref:BloombergLP/ball/Severity/Level.adoc[Severity::Level] dropRecordsOnFullQueueThreshold, xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* basicAllocator = 0); ---- == Description Create an async file observer that asynchronously publishes log records to `stdout` if their severity is at least as severe as the specified `stdoutThreshold` level, and has file logging initially disabled. The timestamp attribute of published records is written in local time if the specified `publishInLocalTime` flag is `true`, and in UTC time otherwise. Records received by the `publish` method are appended to a queue having the specified (fixed) `maxRecordQueueSize`, and published later by an independent publication thread. The specified `dropRecordsOnFullQueueThreshold` indicates the severity threshold below which records received when the queue is full will be discarded; records received whose severity is at least as severe as this threshold will block the calling thread if the queue is full, until space is available. (See {Log Record Queue} for further information.) Optionally specify a `basicAllocator` used to supply memory. If `basicAllocator` is 0, the currently installed default allocator is used. Note that independent default record formats are in effect for `stdout` and file logging (see `setLogFormat`). == Parameters [cols="1,4"] |=== | Name| Description | *stdoutThreshold* | minimum severity for records logged to `stdout` | *publishInLocalTime* | whether timestamps are written in local time | *maxRecordQueueSize* | maximum number of queued unpublished records | *dropRecordsOnFullQueueThreshold* | severity below which full‐queue records are dropped | *basicAllocator* | memory allocator; null uses the default |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#