Created
January 8, 2017 10:19
-
-
Save igor-makarov/31941c43cd8e7a309820d58e8900a41a to your computer and use it in GitHub Desktop.
Log4swift Appender for Buglife
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Buglife | |
import Log4swift | |
class BuglifeLogAppender: Log4swift.Appender { | |
override public func performLog(_ log: String, level: LogLevel, info: LogInfoDictionary) { | |
var lifeLogType: LIFEAwesomeLogType | |
switch level { | |
case .Trace, .Debug, .Off: | |
lifeLogType = .debug | |
case .Warning, .Info: | |
lifeLogType = .info | |
case .Fatal, .Error: | |
lifeLogType = .error | |
} | |
let filename: String = (info[LogInfoKeys.FileName] as? String) ?? "" | |
let methodName: String = (info[LogInfoKeys.Function] as? String) ?? "" | |
let lineNumber: UInt = UInt((info[LogInfoKeys.FileLine] as? Int) ?? 0) | |
LIFEAwesomeLogger.shared().log(false, | |
type: lifeLogType, | |
file: filename, | |
function: methodName, | |
line: lineNumber, | |
message: log) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment