> I would like to update my draft proposal to introduce a test for debug
> configurations using a public function
> rather than a build configuration test.
>
> * Would the stdlib team be open to that?
> * What would be an appropriate name? `debugConfiguration`? `debugBuild`?
> `isDebugBuild`? `isDebugConfiguration`?
I have a suggestion:
if #isDebugBuild {
...
}
That would allow you to capture a caller's debug setting, just as you can
capture their file and line number:
class Logger {
enum LogLevel {
case fatal, error, warn, info, debug, trace, off
}
init(logLevel: LogLevel) {
...
}
convenience init(debug: Bool = #isDebugBuild) {
self.init(logLevel: debug ? .debug : .warn)
}
...
}
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution