mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-21 00:49:49 +01:00
WIP: logging utilities
This commit is contained in:
@@ -46,11 +46,11 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
self.transactionQueue.isCurrentExecutionContext(),
|
||||
"Attempted to commit a \(typeName(self)) outside its designated queue."
|
||||
"Attempted to commit a \(cs_typeName(self)) outside its designated queue."
|
||||
)
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to commit a \(typeName(self)) more than once."
|
||||
"Attempted to commit a \(cs_typeName(self)) more than once."
|
||||
)
|
||||
|
||||
self.isCommitted = true
|
||||
@@ -70,11 +70,11 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
self.transactionQueue.isCurrentExecutionContext(),
|
||||
"Attempted to begin a child transaction from a \(typeName(self)) outside its designated queue."
|
||||
"Attempted to begin a child transaction from a \(cs_typeName(self)) outside its designated queue."
|
||||
)
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to begin a child transaction from an already committed \(typeName(self))."
|
||||
"Attempted to begin a child transaction from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
return SynchronousDataTransaction(
|
||||
@@ -96,7 +96,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to create an entity of type \(typeName(T)) from an already committed \(typeName(self))."
|
||||
"Attempted to create an entity of type \(cs_typeName(T)) from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
return super.create(into)
|
||||
@@ -113,7 +113,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to update an entity of type \(typeName(object)) from an already committed \(typeName(self))."
|
||||
"Attempted to update an entity of type \(cs_typeName(object)) from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
return super.edit(object)
|
||||
@@ -131,7 +131,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to update an entity of type \(typeName(T)) from an already committed \(typeName(self))."
|
||||
"Attempted to update an entity of type \(cs_typeName(T)) from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
return super.edit(into, objectID)
|
||||
@@ -146,7 +146,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to delete an entity of type \(typeName(object)) from an already committed \(typeName(self))."
|
||||
"Attempted to delete an entity of type \(cs_typeName(object)) from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
super.delete(object)
|
||||
@@ -163,7 +163,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to delete an entities from an already committed \(typeName(self))."
|
||||
"Attempted to delete an entities from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
super.delete(([object1, object2] + objects).flatMap { $0 })
|
||||
@@ -178,7 +178,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to delete an entities from an already committed \(typeName(self))."
|
||||
"Attempted to delete an entities from an already committed \(cs_typeName(self))."
|
||||
)
|
||||
|
||||
super.delete(objects)
|
||||
@@ -204,7 +204,7 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.log(
|
||||
.Warning,
|
||||
message: "The closure for the \(typeName(self)) completed without being committed. All changes made within the transaction were discarded."
|
||||
message: "The closure for the \(cs_typeName(self)) completed without being committed. All changes made within the transaction were discarded."
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -224,11 +224,11 @@ public final class SynchronousDataTransaction: BaseDataTransaction {
|
||||
|
||||
CoreStore.assert(
|
||||
!self.isCommitted,
|
||||
"Attempted to rollback an already committed \(typeName(self))."
|
||||
"Attempted to rollback an already committed \(cs_typeName(self))."
|
||||
)
|
||||
CoreStore.assert(
|
||||
self.transactionQueue.isCurrentExecutionContext(),
|
||||
"Attempted to rollback a \(typeName(self)) outside its designated queue."
|
||||
"Attempted to rollback a \(cs_typeName(self)) outside its designated queue."
|
||||
)
|
||||
|
||||
self.context.reset()
|
||||
|
||||
Reference in New Issue
Block a user