Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
A custom destination to log SwiftyBeaver calls through to Bugfender.
Via http://support.bugfender.com/supported-logging-frameworks/swiftybeaver-support
*/
import Foundation
import SwiftyBeaver
import BugfenderSDK
public class BugfenderDestination: BaseDestination {
override public var defaultHashValue: Int { return 100 }
override public func send(_ level: SwiftyBeaver.Level, msg: String, thread: String, file: String, function: String, line: Int, context: Any?) -> String? {
var bfLogLevel: BFLogLevel? {
switch(level) {
case .error:
return BFLogLevel.error
case .warning:
return BFLogLevel.warning
case .info:
return BFLogLevel.default
default:
return nil
}
}
if let logLevel = bfLogLevel {
Bugfender.log(lineNumber: line, method: function, file: file, level: logLevel, tag: thread, message: msg)
}
return super.send(level, msg: msg, thread: thread, file: file, function: function, line: line)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.