Skip to content

Commit c0bc15e

Browse files
authored
Merge pull request shaps80#7 from GeekAndDad/issue2viaprop
fix shaps80#2 via a property settable in tests.
2 parents 1290388 + fa1b7ae commit c0bc15e

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

.swiftpm/xcode/xcshareddata/xcschemes/Logging.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</BuildActionEntries>
2424
</BuildAction>
2525
<TestAction
26-
buildConfiguration = "Release"
26+
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES"

Sources/Logging/Interpolation.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,17 @@ public struct LogIntegerFormatting {
177177
LogPrivacy(isPrivate: true, mask: mask)
178178
}
179179

180+
#if DEBUG
181+
internal static var disableRedaction: Bool = true
182+
#endif
183+
180184
internal static let redacted = "<redacted>"
181185
internal func value(for value: Any) -> String {
182186
#if DEBUG
183-
return String(describing: value)
184-
#else
187+
if LogPrivacy.disableRedaction {
188+
return String(describing: value)
189+
}
190+
#endif
185191

186192
switch self {
187193
case .public:
@@ -191,6 +197,5 @@ public struct LogIntegerFormatting {
191197
default:
192198
return Self.redacted
193199
}
194-
#endif
195200
}
196201
}

Tests/LoggingTests/Test+Private.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ final class PrivateTests: XCTestCase {
66
func testPrivate() {
77
let signed = -3.14159265359
88
let unsigned = 3.14
9+
#if DEBUG
10+
LogPrivacy.disableRedaction = false
11+
#endif
912
let logging = TestLogging()
1013
LoggingSystem.bootstrapInternal(logging.make)
1114

0 commit comments

Comments
 (0)