LXHTTPJSONEndpoint

public class LXHTTPJSONEndpoint: LXHTTPEndpoint

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

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

  • Initialize an HTTP JSON Endpoint. Log Entries will be converted to JSON automatically.

    Declaration

    Swift

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

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

  • Initialize an HTTP JSON Endpoint. Log Entries will be converted to JSON automatically.

    Declaration

    Swift

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

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