Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bugfender XCGLogger Integration
//
// XCGBugfenderLogDestination.swift
//
// Created by Manuel Robledo on 17.03.16.
// Copyright © 2016 insertEFFECT GmbH. All rights reserved.
//
import Foundation
import XCGLogger
class XCGBugfenderLogDestination: XCGBaseLogDestination {
override func output(logDetails: XCGLogDetails, text: String) {
let fileURL = NSURL(fileURLWithPath: logDetails.fileName)
var logLevel = BFLogLevel.Default
switch logDetails.logLevel {
case .Warning:
logLevel = .Warning
case .Error:
logLevel = .Error
case .Severe:
logLevel = .Error
default:
logLevel = .Default
}
Bugfender.logLineNumber(logDetails.lineNumber, method: logDetails.functionName, file: fileURL.lastPathComponent, level: logLevel, tag: nil, message: logDetails.logMessage)
}
}
@redlock

This comment has been minimized.

Copy link

commented Jun 21, 2017

Updated for version 5 of XCGLogger and Swift 3

class XCGBugfenderLogDestination: BaseQueuedDestination {
    override func output(logDetails: LogDetails, message: String) {
        
        let fileURL = NSURL(fileURLWithPath: logDetails.fileName)
        
        var logLevel = BFLogLevel.default
        
        switch logDetails.level {
        case .warning:
            logLevel = .warning
        case .error:
            logLevel = .error
        case .severe:
            logLevel = .error
        default:
            logLevel = BFLogLevel.default
        }
        
        Bugfender.log(lineNumber:logDetails.lineNumber, method: logDetails.functionName, file: fileURL.lastPathComponent ?? "unknown", level: logLevel, tag: nil, message: logDetails.message)
    }
}
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.