Created
September 8, 2017 12:11
-
-
Save rostopira/1cdf1480eabe17206608152a3ef93885 to your computer and use it in GitHub Desktop.
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
package com.kid.gl.utils | |
import android.util.Log | |
import com.google.firebase.crash.FirebaseCrash | |
import com.google.firebase.database.DatabaseError | |
import gl.kid.alert.BuildConfig | |
private const val TAG = "FirePig" | |
class FirePig(message: String): Exception(message) { | |
companion object { | |
fun fly(vararg objects: Any?) { | |
val text = objects.joinToString(" ") | |
FirePig(text).fly() | |
Log.wtf(TAG, text) | |
} | |
} | |
} | |
fun Throwable.fly(tag: String = TAG) { | |
if (!BuildConfig.DEBUG) | |
FirebaseCrash.report(this) | |
Log.wtf(tag, this) | |
} | |
fun DatabaseError.fly(tag: String = TAG) { | |
this.toException().fly(tag) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment