WIP: logging utilities

This commit is contained in:
John Rommel Estropia
2016-05-05 09:44:14 +08:00
parent 099dcfab68
commit 0073d038e0
46 changed files with 791 additions and 396 deletions

View File

@@ -44,10 +44,10 @@ public extension BaseDataTransaction {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
"Attempted to import an object of type \(cs_typeName(into.entityClass)) outside the transaction's designated queue."
)
return try autoreleasepool {
return try cs_autoreleasepool {
guard T.shouldInsertFromImportSource(source, inTransaction: self) else {
@@ -72,10 +72,10 @@ public extension BaseDataTransaction {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(object)) outside the transaction's designated queue."
"Attempted to import an object of type \(cs_typeName(object)) outside the transaction's designated queue."
)
try autoreleasepool {
try cs_autoreleasepool {
guard T.shouldInsertFromImportSource(source, inTransaction: self) else {
@@ -99,10 +99,10 @@ public extension BaseDataTransaction {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
"Attempted to import an object of type \(cs_typeName(into.entityClass)) outside the transaction's designated queue."
)
return try autoreleasepool {
return try cs_autoreleasepool {
return try sourceArray.flatMap { (source) -> T? in
@@ -111,7 +111,7 @@ public extension BaseDataTransaction {
return nil
}
return try autoreleasepool {
return try cs_autoreleasepool {
let object = self.create(into)
try object.didInsertFromImportSource(source, inTransaction: self)
@@ -134,10 +134,10 @@ public extension BaseDataTransaction {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
"Attempted to import an object of type \(cs_typeName(into.entityClass)) outside the transaction's designated queue."
)
return try autoreleasepool {
return try cs_autoreleasepool {
let uniqueIDKeyPath = T.uniqueIDKeyPath
guard let uniqueIDValue = try T.uniqueIDFromImportSource(source, inTransaction: self) else {
@@ -185,13 +185,13 @@ public extension BaseDataTransaction {
CoreStore.assert(
self.isRunningInAllowedQueue(),
"Attempted to import an object of type \(typeName(into.entityClass)) outside the transaction's designated queue."
"Attempted to import an object of type \(cs_typeName(into.entityClass)) outside the transaction's designated queue."
)
return try autoreleasepool {
return try cs_autoreleasepool {
var mapping = Dictionary<T.UniqueIDType, T.ImportSource>()
let sortedIDs = try autoreleasepool {
let sortedIDs = try cs_autoreleasepool {
return try sourceArray.flatMap { (source) -> T.UniqueIDType? in
@@ -205,12 +205,12 @@ public extension BaseDataTransaction {
}
}
mapping = try autoreleasepool { try preProcess(mapping: mapping) }
mapping = try cs_autoreleasepool { try preProcess(mapping: mapping) }
var objects = Dictionary<T.UniqueIDType, T>()
for object in self.fetchAll(From(T), Where(T.uniqueIDKeyPath, isMemberOf: mapping.keys)) ?? [] {
try autoreleasepool {
try cs_autoreleasepool {
let uniqueIDValue = object.uniqueIDValue
@@ -227,7 +227,7 @@ public extension BaseDataTransaction {
for (uniqueIDValue, source) in mapping {
try autoreleasepool {
try cs_autoreleasepool {
guard T.shouldInsertFromImportSource(source, inTransaction: self) else {