Remove all RDEPUBBackgroundTrace.log and bare print diagnostic calls
Keep only the evaluateFullPageMapTakeover: fullReplace diagnostic log in RDEPUBPageMapReconciliationCoordinator.swift for future debugging. Simplified RDEPUBBackgroundTrace to just the log method (removed measure and debug gating). Removed all [EPUB][...], [ReadViewDemo], and [EPUB][Pagination] print statements across the project. Also includes earlier bug fixes: - Fix stale currentPageNumber in extendPartial commit - Fix pageCurl rebindVisiblePage during transition - Fix keepCurrentWindow not removing pending update from queue - Fix right-aligned text (巫鸿 bug) via avoidPageBreakInside, tail merger, and continuation paragraph normalization - Add text-indent reset for aligned blocks in CSS compatibility layer Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+3
-53
@@ -2,59 +2,9 @@ import Foundation
|
||||
|
||||
enum RDEPUBBackgroundTrace {
|
||||
|
||||
static var isEnabled: Bool {
|
||||
#if DEBUG
|
||||
return _enabled
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
}
|
||||
|
||||
static var _enabled = true
|
||||
|
||||
static func log(_ scope: String, _ message: String) {
|
||||
guard isEnabled else { return }
|
||||
let threadRole = Thread.isMainThread ? "main" : "bg"
|
||||
|
||||
let threadName = resolvedThreadName()
|
||||
|
||||
let queueLabel = resolvedQueueLabel()
|
||||
print("[EPUB][\(scope)][\(threadRole)][queue=\(queueLabel)][thread=\(threadName)] \(message)")
|
||||
let queueLabel = String(validatingUTF8: __dispatch_queue_get_label(nil)) ?? "unknown"
|
||||
print("[EPUB][\(scope)][\(threadRole)][queue=\(queueLabel)] \(message)")
|
||||
}
|
||||
|
||||
static func measure<T>(_ scope: String, _ message: String, work: () throws -> T) rethrows -> T {
|
||||
guard isEnabled else { return try work() }
|
||||
let startedAt = CFAbsoluteTimeGetCurrent()
|
||||
log(scope, "START \(message)")
|
||||
do {
|
||||
|
||||
let result = try work()
|
||||
|
||||
let elapsedMs = Int((CFAbsoluteTimeGetCurrent() - startedAt) * 1000)
|
||||
log(scope, "END \(message) elapsedMs=\(elapsedMs)")
|
||||
return result
|
||||
} catch {
|
||||
|
||||
let elapsedMs = Int((CFAbsoluteTimeGetCurrent() - startedAt) * 1000)
|
||||
log(scope, "FAIL \(message) elapsedMs=\(elapsedMs) error=\(error)")
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
private static func resolvedThreadName() -> String {
|
||||
|
||||
if let name = Thread.current.name, !name.isEmpty {
|
||||
return name
|
||||
}
|
||||
|
||||
if Thread.isMainThread {
|
||||
return "main"
|
||||
}
|
||||
|
||||
return String(describing: Unmanaged.passUnretained(Thread.current).toOpaque())
|
||||
}
|
||||
|
||||
private static func resolvedQueueLabel() -> String {
|
||||
String(validatingUTF8: __dispatch_queue_get_label(nil)) ?? "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user