FileEndpoint

public class FileEndpoint: RotatingFileEndpoint

An Endpoint that writes Log Entries to a specified file.

  • Initialize a File Endpoint.

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

    Declaration

    Swift

    public init?(
            fileURL: NSURL? = defaultLogFileURL,
            shouldAppend: Bool = true,
            minimumPriorityLevel: LXPriorityLevel = .All,
            dateFormatter: LXDateFormatter = LXDateFormatter.standardFormatter(),
            entryFormatter: LXEntryFormatter = LXEntryFormatter.standardFormatter()
        )

    Parameters

    fileURL

    The URL of the log file. Defaults to Application Support/{bundleID}/logs/log.txt. Must not be nil.

    shouldAppend

    Indicates whether the Endpoint should continue appending Log Entries to the end of the file, or clear it and start at the beginning. Defaults to true.

    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. File Endpoint does not rotate.

    Declaration

    Swift

    public override func rotate()