Skip to content

Commit

Permalink
reverting out overzealo (#168)
Browse files Browse the repository at this point in the history
us trace logging
  • Loading branch information
heckj authored May 7, 2024
1 parent c19ba09 commit 212c711
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
33 changes: 17 additions & 16 deletions Sources/Automerge/BoundTypes/AutomergeText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,23 @@ import os

extension AutomergeText: ObservableObject {
fileprivate func sendObjectWillChange() {
#if canImport(os)
if #available(macOS 11, iOS 14, *) {
let logger = Logger(subsystem: "Automerge", category: "AutomergeText")
logger.trace("\(self.debugDescription) sending ObjectWillChange")
let callStacks = Thread.callStackSymbols
if callStacks.count > 5 {
for callStackFrame in callStacks[0 ... 5] {
logger.trace(" - \(callStackFrame)")
}
} else {
for callStackFrame in callStacks {
logger.trace(" - \(callStackFrame)")
}
}
}
#endif
// DEBUGGING / DIAGNOSTICS CODE to show where object changes are being initiated
// #if canImport(os)
// if #available(macOS 11, iOS 14, *) {
// let logger = Logger(subsystem: "Automerge", category: "AutomergeText")
// logger.trace("\(self.debugDescription) sending ObjectWillChange")
// let callStacks = Thread.callStackSymbols
// if callStacks.count > 5 {
// for callStackFrame in callStacks[0 ... 5] {
// logger.trace(" - \(callStackFrame)")
// }
// } else {
// for callStackFrame in callStacks {
// logger.trace(" - \(callStackFrame)")
// }
// }
// }
// #endif
objectWillChange.send()
}
}
Expand Down
39 changes: 17 additions & 22 deletions Sources/Automerge/Document.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1055,28 +1055,23 @@ import OSLog

extension Document: ObservableObject {
fileprivate func sendObjectWillChange() {
#if canImport(os)
if #available(macOS 11, iOS 14, *) {
let logger = Logger(subsystem: "Automerge", category: "AutomergeText")

logger.trace("Document \(String(describing: self)) sending ObjectWillChange")
// concurrency violation
// let headsString = self.heads().map { ch in
// ch.debugDescription
// }.joined(separator: ".")
// logger.trace("heads: \(headsString)")
let callStacks = Thread.callStackSymbols
if callStacks.count > 5 {
for callStackFrame in callStacks[0 ... 5] {
logger.trace(" - \(callStackFrame)")
}
} else {
for callStackFrame in callStacks {
logger.trace(" - \(callStackFrame)")
}
}
}
#endif
// DEBUGGING / DIAGNOSTICS CODE to show where object changes are being initiated
// #if canImport(os)
// if #available(macOS 11, iOS 14, *) {
// let logger = Logger(subsystem: "Automerge", category: "AutomergeText")
// logger.trace("Document \(String(describing: self)) sending ObjectWillChange")
// let callStacks = Thread.callStackSymbols
// if callStacks.count > 5 {
// for callStackFrame in callStacks[0 ... 5] {
// logger.trace(" - \(callStackFrame)")
// }
// } else {
// for callStackFrame in callStacks {
// logger.trace(" - \(callStackFrame)")
// }
// }
// }
// #endif
objectWillChange.send()
}
}
Expand Down

0 comments on commit 212c711

Please sign in to comment.