AsyncConcurrencyModeOption

public enum AsyncConcurrencyModeOption

Async mode can be configured for various options, this enum allows you to refine the behavior and options of the asynchronous mode of operation.

See also

ConcurrencyMode.async(options:) for for more information about usage.

See also

WriterConcurrencyMode.async(_:options:) for for more information about usage.
  • Back the async mode with a buffer for when the writer is not available to write to it’s endpoint. Useful for situations where the endpoint may not be available at all times.

    Whenever the writer returns false for available TraceLog will buffer the log entries until the endpoint is available. It will check the writer for availability based on the writeInterval parameter. Once available, TraceLog will write each log entry in the buffer (in order) until the end of the buffer or the Writer becomes unavailable again.

    Remark

    Buffering is useful for many different use case including:

    In an iOS application when protected data is not available to your app but you require visibility into the apps logging even during these times.

    A network writer when the network connection is unavailable for any reason.

    Declaration

    Swift

    public static func buffer(writeInterval: DispatchTimeInterval = .seconds(60), strategy: BufferStrategy = .dropTail(at: 1000)) -> AsyncConcurrencyModeOption

    Parameters

    writeInternal

    if the writer is currently buffering, TraceLog will periodically check whether the writer is available and write if it is. This is the time frame between checks.

    strategy

    The buffer strategy to use when buffering.

  • A BufferStrategy is the action the internal buffer will take when a new log entry is logged but the buffer is at it’s limit (maxSize).

    See also

    ConcurrencyMode.async(options:) for for more information about usage.
    See more

    Declaration

    Swift

    public enum BufferStrategy
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Declaration

    Swift

    public static func == (lhs: AsyncConcurrencyModeOption, rhs: AsyncConcurrencyModeOption) -> Bool