I use Swift 2.2 on Linux, and I need to write some debugging output in a standard error stream.
I am currently doing the following:
import Foundation
public struct StderrOutputStream: OutputStreamType {
public mutating func write(string: String) { fputs(string, stderr) }
}
public var errStream = StderrOutputStream()
debugPrint("Debug messages...", toStream: &errStream)
However, I upgraded Swift to version 2.2.1, but it seems that it is Foundationno longer available.
How to record a standard error stream with Swift 2.2.1 (and this will still work the next update)?
source
share