Skip to content

Commit bc7f904

Browse files
committed
Preserve verbosity argument in HumanReadableOutputRecorder.record().
This PR restores/undeprecates the `verbosity` argument to `HumanReadableOutputRecorder.record()` that was deprecated in #677. We still need to be able to override the command-line-specified value in the event stream.
1 parent 5843e4d commit bc7f904

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

Sources/Testing/ABI/v0/ABIv0.Record+Streaming.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ extension ABIv0.Record {
7979
eventHandler(testJSON)
8080
}
8181
} else {
82-
let messages = humanReadableOutputRecorder.record(event, in: context)
82+
let messages = humanReadableOutputRecorder.record(event, in: context, verbosity: 0)
8383
if let eventRecord = Self(encoding: event, in: context, messages: messages) {
8484
try? JSON.withEncoding(of: eventRecord, eventHandler)
8585
}

Sources/Testing/Events/Recorder/Event.HumanReadableOutputRecorder.swift

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,27 @@ extension Event.HumanReadableOutputRecorder {
202202
/// - Parameters:
203203
/// - event: The event to record.
204204
/// - eventContext: The context associated with the event.
205+
/// - verbosity: How verbose output should be. When the value of this
206+
/// argument is greater than `0`, additional output is provided. When the
207+
/// value of this argument is less than `0`, some output is suppressed.
208+
/// If the value of this argument is `nil`, the value set for the current
209+
/// configuration is used instead. The exact effects of this argument are
210+
/// implementation-defined and subject to change.
205211
///
206212
/// - Returns: An array of zero or more messages that can be displayed to the
207213
/// user.
208-
@discardableResult public func record(_ event: borrowing Event, in eventContext: borrowing Event.Context) -> [Message] {
209-
let verbosity = eventContext.configuration?.verbosity ?? 0
214+
@discardableResult public func record(
215+
_ event: borrowing Event,
216+
in eventContext: borrowing Event.Context,
217+
verbosity: Int? = nil
218+
) -> [Message] {
219+
let verbosity: Int = if let verbosity {
220+
verbosity
221+
} else if let verbosity = eventContext.configuration?.verbosity {
222+
verbosity
223+
} else {
224+
0
225+
}
210226
let test = eventContext.test
211227
let testName = if let test {
212228
if let displayName = test.displayName {
@@ -501,12 +517,3 @@ extension Event.HumanReadableOutputRecorder {
501517
// MARK: - Codable
502518

503519
extension Event.HumanReadableOutputRecorder.Message: Codable {}
504-
505-
// MARK: - Deprecated
506-
507-
extension Event.HumanReadableOutputRecorder {
508-
@available(*, deprecated, message: "Use record(_:in:) instead. Verbosity is now controlled by eventContext.configuration.verbosity.")
509-
@discardableResult public func record(_ event: borrowing Event, in eventContext: borrowing Event.Context, verbosity: Int) -> [Message] {
510-
record(event, in: eventContext)
511-
}
512-
}

0 commit comments

Comments
 (0)