From a6e56c69bcb09b6722f7170747d161c808f01c8a Mon Sep 17 00:00:00 2001 From: John Estropia Date: Sat, 18 Jul 2015 23:22:47 +0900 Subject: [PATCH] Updated Logging and error handling (markdown) --- Logging-and-error-handling.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Logging-and-error-handling.md b/Logging-and-error-handling.md index 45e909e..f4e0323 100644 --- a/Logging-and-error-handling.md +++ b/Logging-and-error-handling.md @@ -1,4 +1,4 @@ -One unfortunate thing when using some third-party libraries is that they usually pollute the console with their own logging mechanisms. CoreStore provides it's own default logging class, but you can plug-in your own favorite logger by implementing the `CoreStoreLogger` protocol. +One unfortunate thing when using some third-party libraries is that they usually pollute the console with their own logging mechanisms. CoreStore provides its own default logging class, but you can plug-in your own favorite logger by implementing the `CoreStoreLogger` protocol. ```swift final class MyLogger: CoreStoreLogger { func log(#level: LogLevel, message: String, fileName: StaticString, lineNumber: Int, functionName: StaticString) { @@ -20,13 +20,7 @@ CoreStore.logger = MyLogger() ``` Doing so channels all logging calls to your logger. -Note that to keep the call stack information intact, all calls to these methods are not thread-managed. Thus you have to make sure that your logger is thread-safe or you may otherwise have to dispatch your logging implementation to a serial queue. - -## Observing changes and notifications -CoreStore provides type-safe wrappers for observing managed objects: - -- `ManagedObjectController`: use to observe changes to a single `NSManagedObject` instance (instead of Key-Value Observing) -- `ManagedObjectListController`: use to observe changes to a list of `NSManagedObject` instances (instead of `NSFetchedResultsController`) +Note that to keep the call stack information intact, all calls to these methods are **NOT** thread-managed. Therefore you have to make sure that your logger is thread-safe or you may otherwise have to dispatch your logging implementation to a serial queue. ## Contents