LXHTTPEndpoint

public class LXHTTPEndpoint: LXEndpoint

An Endpoint that uploads Log Entries to an HTTP service in plaintext format.

Upload and retry management are handled automatically by this Endpoint. It attempts to upload Log Entries in order, but makes no guarantees.

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

    Declaration

    Swift

    public var minimumPriorityLevel: LXPriorityLevel
  • The formatter used by this Endpoint to serialize a Log Entry’s dateTime property to a string.

    Declaration

    Swift

    public var dateFormatter: LXDateFormatter
  • The formatter used by this Endpoint to serialize each Log Entry to a string.

    Declaration

    Swift

    public var entryFormatter: LXEntryFormatter
  • This Endpoint does not require a newline character appended to each serialized Log Entry string.

    Declaration

    Swift

    public let requiresNewlines: Bool = false
  • Initialize an HTTP Endpoint.

    Declaration

    Swift

    public init(
            request: NSURLRequest,
            successCodes: Set<Int> = defaultSuccessCodes,
            sessionConfiguration: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration(),
            minimumPriorityLevel: LXPriorityLevel = .All,
            dateFormatter: LXDateFormatter = LXDateFormatter.standardFormatter(),
            entryFormatter: LXEntryFormatter = LXEntryFormatter.standardFormatter()
        )

    Parameters

    request

    The request that will be used when submitting uploads.

    successCodes

    The set of HTTP status codes the server might respond with to indicate a successful upload. Defaults to {200, 201, 202, 204}.

    sessionConfiguration

    The configuration to be used when initializating this Endpoint’s URL session. Defaults to .defaultSessionConfiguration().

    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().

  • Initialize an HTTP Endpoint.

    Declaration

    Swift

    public convenience init(
            URL: NSURL,
            HTTPMethod: String,
            successCodes: Set<Int> = defaultSuccessCodes,
            sessionConfiguration: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration(),
            minimumPriorityLevel: LXPriorityLevel = .All,
            dateFormatter: LXDateFormatter = LXDateFormatter.standardFormatter(),
            entryFormatter: LXEntryFormatter = LXEntryFormatter.standardFormatter()
        )

    Parameters

    URL

    The URL to upload Log Entries to.

    HTTPMethod

    The HTTP request method to be used when uploading Log Entries.

    successCodes

    The set of HTTP status codes the server might respond with to indicate a successful upload. Defaults to {200, 201, 202, 204}.

    sessionConfiguration

    The configuration to be used when initializating this Endpoint’s URL session. Defaults to .defaultSessionConfiguration().

    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().

  • Submits a serialized Log Entry string for uploading.

    Declaration

    Swift

    public func write(string: String)