0

I combined SwiftyBeaver with Crashlytics to log all errors to Crashlytics.

For this I created this SwiftyBeaver BaseDestination:

public class CrashlyticsDestination: BaseDestination {

        override public func send(_ level: SwiftyBeaver.Level, msg: String, thread: String, file: String, function: String, line: Int, context: Any? = nil) -> String? {
            guard level == .error else {return nil}

            let formattedString = super.send(level, msg: msg, thread: thread, file: file, function: function, line: line)
            if let str = formattedString {
                CLSLogv(str, getVaList([str]))
            }
            return formattedString
        }
    } 

CLSLogv is getting called but I do not see anything in Crashlytics or a error message in console. But if I force a crash I can see this crash there.

Any idea what could be wrong?

netshark1000
  • 7,245
  • 9
  • 59
  • 116

1 Answers1

0

CLSLogv will only send logs with a crash or a non-fatal exceptions. Calling CLSLogv does not really do anything by itself!

Also make sure that this logs are being set before a crash / non-fatal error occurs.

Chintan
  • 651
  • 4
  • 15