AppleDiagnosticLogWriter
Opt-in, app-lifetime file writer shared by Apple hosts. The host owns preferences and logger configuration. Use distinct stream names for the app and extensions. All instances sharing a root coordinate through flock.
Writes are best effort: a full submission queue, unavailable storage, or another process holding the lock drops the entry. Entries over 32K message/tag characters and queues over 256K characters are also dropped. Throwable references are retained until processing; their stack traces are formatted only on the IO queue. Lock acquisition never waits. Accepted entries close their sinks before the next queue operation. File IO itself can stall; extension completion must use flushLogsWithin, never an unbounded flush.
Constructors
Functions
Copy every stream into a new private directory. Contention or storage errors are reported to the caller.
Delete regular diagnostic files across all streams, retaining preferences, lock file, and unrelated files.
Drop queued entries after expiry; an already executing filesystem operation is allowed to finish.
Completion barrier with a caller-supplied budget. False means the barrier did not finish in that budget. Attempts a coverage checkpoint without logging recursively. A failed checkpoint leaves older coverage; dropped entries still count as finished. This is not a durability promise.
Stop accepting entries immediately, then finish earlier accepted entries even if the caller is cancelled.
Refresh host-owned opt-in without IO or waiting for accepted writes.