WIP: object concurrency debugging utilities

This commit is contained in:
John Estropia
2017-02-02 19:53:47 +09:00
parent 7b961fa249
commit 69d96c53d6
6 changed files with 276 additions and 0 deletions

View File

@@ -47,6 +47,11 @@ public enum LogLevel {
*/
public protocol CoreStoreLogger {
/**
When `true`, all `NSManagedObject` attribute and relationship access will raise an assertion when executed on the wrong transaction/datastack queue. Defaults to `false` if not implemented.
*/
var enableObjectConcurrencyDebugging: Bool { get set }
/**
Handles log messages sent by the `CoreStore` framework.
@@ -94,6 +99,12 @@ public protocol CoreStoreLogger {
extension CoreStoreLogger {
public var enableObjectConcurrencyDebugging: Bool {
get { return false }
set {}
}
public func abort(_ message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) {
Swift.fatalError(message, file: fileName, line: UInt(lineNumber))