ConcurrencyMode

public enum ConcurrencyMode

The system wide modes that TraceLog can run in. Used to configure a mode globally at configure time.

See also

TraceLog.configure(mode:writers:environment:) for usage.
  • The default mode used if no mode is specified (.async(options: [])).

    Declaration

    Swift

    case `default`
  • Direct, as the name implies, will directly call the writer from the calling thread with no indirection. It will block until the writer(s) in this mode have completed the write to the endpoint.

    Useful for scripting applications and other applications where it is required for the call not to return until the message is printed.

    Declaration

    Swift

    case direct
  • Synchronous blocking mode is similar to direct in that it blocks but this mode also uses a queue for all writes. The benefits of that is that all threads writing to the log will be serialized through before calling the writer (one call to the writer at a time).

    Declaration

    Swift

    case sync
  • Asynchronous non-blocking mode. A general mode used for most application which moves processing of the write to a background queue for minimal delays when logging.

    Remark

    Once Swift Evolution SE-0155 is implemented this will func will be changed to a case in the enum with default values. We must use a func now to work around the lack of defaults on enums.

    See also

    AsyncConcurrencyModeOption for details.

    Declaration

    Swift

    public static func async(options: Set<AsyncConcurrencyModeOption> = []) -> ConcurrencyMode

    Parameters

    options

    An array specifying the optional features to configure for each async writer that gets added.