Change the default implementation with an extension in unit tests
<p>I have a simple protocol called <code>Loggable</code> that I want to use to create log entries in my app. The default implementation of the protocol is done with the use of an extension. I want to change that default implementation on my tests to discard any logs on the console while the app is being tested.</p>

<pre><code>protocol Loggable {
    func log(message: String, level: LogLevel, customAttributes: [String : AnyObject]?, filename: NSString, line: Int, function: String)
}
</code></pre>

<p>So, the default implementation is something like:</p>

<pre><code>extension Loggable {
    func log(message: String, level: LogLevel = .Debug, customAttributes: [String : AnyObject]? = nil, filename: NSString = #file, line: Int = #line, function: String = #function) {
        // Log internally
        InternalLog.log(message, level: level, customAttributes: customAttributes, filename: filename, line: line, function: function)
        // Log remotely
        // Fabric, LogEntries ?!
    }
}
</code></pre>

<p>In the unit test I'm doing:</p>

<pre><code>extension Loggable {
    func log(message: String, level: LogLevel = .Debug, customAttributes: [String : AnyObject]? = nil, filename: NSString = #file, line: Int = #line, function: String = #function) {
        // Do nothing
    }
}
</code></pre>

<p>The problem is that all the logs are being printed when I run the test suite. It never uses the extension of <code>Loggable</code> added on the unit test.</p>

<p>I know that <em>Swift Extensions</em> can not override but this example is using different targets.</p>

<p>Any nature way to achieve my idea?</p>