Skip to content

Commit

Permalink
🖨 Fix print override
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-araman committed May 2, 2021
1 parent 66b61c6 commit 3059bf3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Sources/MasKit/Formatters/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ var printObserver: ((String) -> Void)?
// Override global print for testability.
// See MasKitTests/OutputListener.swift.
func print(_ items: Any..., separator: String = " ", terminator: String = "\n") {
let output = items
.map { "\($0)" }
.joined(separator: separator)
.appending(terminator)

if let observer = printObserver {
let output = items
.map { "\($0)" }
.joined(separator: separator)
.appending(terminator)
observer(output)
}

Swift.print(items, separator: separator, terminator: terminator)
Swift.print(output)
}

func printInfo(_ message: String) {
Expand Down

0 comments on commit 3059bf3

Please sign in to comment.