[swift-evolution] [DRAFT] Introducing a Debug Build Configuration Test
Brent Royal-Gordon
brent at architechies.com
Thu Mar 17 04:14:38 CDT 2016
> 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
More information about the swift-evolution
mailing list