RSDRecordSampleLogger

public class RSDRecordSampleLogger : RSDDataLogger

RSDRecordSampleLogger is used to write samples encoded as json dictionary objects to a logging file.

  • Errors that can be thrown by the logger.

    See more

    Declaration

    Swift

    public enum RSDRecordSampleLoggerError : Error
  • Is the root element in the json file a dictionary?

    Declaration

    Swift

    public let usesRootDictionary: Bool
  • Does the recorder use a string-delimited format for saving each sample? If so, this contains the keys used to support encoding in that format.

    Declaration

    Swift

    public let stringEncodingFormat: RSDStringSeparatedEncodingFormat?
  • Returns application/json or the string encoding if applicable.

    Declaration

    Swift

    override public var contentType: String? { get }
  • Default initializer. The initializer will automatically open the file and write the JSON root element and start the sample array.

    Declaration

    Swift

    public init(identifier: String, url: URL, usesRootDictionary: Bool, stringEncodingFormat: RSDStringSeparatedEncodingFormat? = nil) throws

    Parameters

    identifier

    A unique identifier for the logger.

    url

    The url to the file.

    usesRootDictionary

    Is the root element in the json file a dictionary?

  • Write multiple samples to the logger.

    Throws

    Error if writing the samples fails because the wasn’t enough memory on the device.

    Declaration

    Swift

    public func writeSamples(_ samples: [RSDSampleRecord]) throws

    Parameters

    samples

    The samples to add to the logging file.

  • Write a sample to the logger.

    Throws

    Error if writing the sample fails because the wasn’t enough memory on the device.

    Declaration

    Swift

    public func writeSample(_ sample: RSDSampleRecord) throws

    Parameters

    sample

    The sample to add to the logging file.

  • Close the file. This will write the end tag for the root element and then close the file handle. If there is an error thrown by writing the closing tag, then the file handle will be closed and the error will be rethrown.

    Throws

    Error thrown when attempting to write the closing tag.

    Declaration

    Swift

    public override func close() throws