RSDDataLogger
open class RSDDataLogger
RSDDataLogger is used to write data samples using a custom encoding to a logging file.
Note
This class does not use a serial queue to process the samples. It is assumed that the recorder that is using this file will handle that implementation.-
A unique identifier for the logger.
Declaration
Swift
public let identifier: String -
The url to the file.
Declaration
Swift
public let url: URL -
Number of samples written to the file.
Declaration
Swift
public private(set) var sampleCount: Int = 0 -
Default initializer. The initializer will automatically open the file and write the initial data (if any).
Declaration
Swift
public init(identifier: String, url: URL, initialData: Data?) throwsParameters
identifierA unique identifier for the logger.
urlThe url to the file.
initialDataThe initial data to write to the file on opening.
-
Write data to the logger.
Throws
Error if writing the data fails because the wasn’t enough memory on the device.Declaration
Swift
open func write(_ data: Data) throwsParameters
dataThe data 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
open func close() throws
View on GitHub
RSDDataLogger Class Reference