CoreStoreLogger

public protocol CoreStoreLogger

Custom loggers should implement the CoreStoreLogger protocol and pass its instance to CoreStoreDefaults.logger. Calls to log(...), assert(...), and abort(...) are not tied to a specific queue/thread, so it is the implementer’s job to handle thread-safety.

  • Handles log messages sent by the CoreStore framework.

    Declaration

    Swift

    func log(level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)

    Parameters

    level

    the severity of the log message

    message

    the log message

    fileName

    the source file name

    lineNumber

    the source line number

    functionName

    the source function name

  • Handles errors sent by the CoreStore framework.

    Declaration

    Swift

    func log(error: CoreStoreError, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)

    Parameters

    error

    the error

    message

    the error message

    fileName

    the source file name

    lineNumber

    the source line number

    functionName

    the source function name

  • Handles assertions made throughout the CoreStore framework.

    Declaration

    Swift

    func assert(_ condition: @autoclosure () -> Bool, message: @autoclosure () -> String, fileName: StaticString, lineNumber: Int, functionName: StaticString)

    Parameters

    condition

    the assertion condition

    message

    the assertion message

    fileName

    the source file name

    lineNumber

    the source line number

    functionName

    the source function name

  • Handles fatal errors made throughout the CoreStore framework. The app wil terminate after this method is called.

    Important

    Implementers may guarantee that the function doesn’t return, either by calling another Never function such as fatalError() or abort(), or by raising an exception. If the implementation does not terminate the app, CoreStore will call an internal fatalError() to do so.

    Default Implementation

    Declaration

    Swift

    func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString)

    Parameters

    message

    the fatal error message

    fileName

    the source file name

    lineNumber

    the source line number

    functionName

    the source function name