Skip to content

Commit 4c7c38b

Browse files
committed
Remove XCTest integration from RuntimeWarnings.swift; change OSLog category
1 parent 85edbea commit 4c7c38b

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

DebugLayout/Sources/DebugLayout/RuntimeWarnings.swift

+7-14
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
//
44
// Based on: Point-Free, Unobtrusive runtime warnings for libraries (2022-01-03)
55
// https://www.pointfree.co/blog/posts/70-unobtrusive-runtime-warnings-for-libraries
6+
//
7+
// Slightly modified by Ole Begemann
68

79
#if DEBUG
810
import os
9-
import XCTestDynamicOverlay
1011

1112
// NB: Xcode runtime warnings offer a much better experience than traditional assertions and
1213
// breakpoints, but Apple provides no means of creating custom runtime warnings ourselves.
@@ -28,7 +29,7 @@
2829
}
2930
return UnsafeMutableRawPointer(mutating: #dsohandle)
3031
}(),
31-
log: OSLog(subsystem: "com.apple.runtime-issues", category: "ComposableArchitecture")
32+
log: OSLog(subsystem: "com.apple.runtime-issues", category: "DebugLayout")
3233
)
3334
#endif
3435

@@ -42,17 +43,9 @@ func runtimeWarning(
4243
) {
4344
#if DEBUG
4445
let message = message()
45-
if _XCTIsTesting {
46-
if let file = file, let line = line {
47-
XCTFail(String(format: "\(message)", arguments: args()), file: file, line: line)
48-
} else {
49-
XCTFail(String(format: "\(message)", arguments: args()))
50-
}
51-
} else {
52-
unsafeBitCast(
53-
os_log as (OSLogType, UnsafeRawPointer, OSLog, StaticString, CVarArg...) -> Void,
54-
to: ((OSLogType, UnsafeRawPointer, OSLog, StaticString, [CVarArg]) -> Void).self
55-
)(.fault, rw.dso, rw.log, message, args())
56-
}
46+
unsafeBitCast(
47+
os_log as (OSLogType, UnsafeRawPointer, OSLog, StaticString, CVarArg...) -> Void,
48+
to: ((OSLogType, UnsafeRawPointer, OSLog, StaticString, [CVarArg]) -> Void).self
49+
)(.fault, rw.dso, rw.log, message, args())
5750
#endif
5851
}

0 commit comments

Comments
 (0)