DatedFileEndpoint

public class DatedFileEndpoint: RotatingFileEndpoint

An Endpoint that writes Log Enties to a dated file. A datestamp will be prepended to the file’s name. The file rotates automatically at midnight UTC.

The notifications LXFileEndpointWillRotateFilesNotification and LXFileEndpointDidRotateFilesNotification are sent to the default notification center directly before and after rotating log files.

  • Initialize a Dated File Endpoint.

    If the specified file cannot be opened, or if the datestamp-prepended URL evaluates to nil, the initializer may fail.

    Declaration

    Swift

    public init?(
            baseURL: NSURL? = defaultLogFileURL,
            minimumPriorityLevel: LXPriorityLevel = .All,
            dateFormatter: LXDateFormatter = LXDateFormatter.standardFormatter(),
            entryFormatter: LXEntryFormatter = LXEntryFormatter.standardFormatter()
        )

    Parameters

    baseURL

    The URL used to build the date files’ URLs. Today’s date will be prepended to the last path component of this URL. Must not be nil. Defaults to Application Support/{bundleID}/logs/{datestamp}_log.txt.

    minimumPriorityLevel

    The minimum Priority Level a Log Entry must meet to be accepted by this Endpoint. Defaults to .All.

    dateFormatter

    The formatter used by this Endpoint to serialize a Log Entry’s dateTime property to a string. Defaults to .standardFormatter().

    entryFormatter

    The formatter used by this Endpoint to serialize each Log Entry to a string. Defaults to .standardFormatter().

  • Does nothing. Dated File Endpoint only rotates by date.

    Declaration

    Swift

    public override func rotate()