Skip to content

Instantly share code, notes, and snippets.

@Krillsson
Last active January 25, 2023 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krillsson/bf4b8dcc5b1fef992e0b68ebf9a89c69 to your computer and use it in GitHub Desktop.
Save Krillsson/bf4b8dcc5b1fef992e0b68ebf9a89c69 to your computer and use it in GitHub Desktop.
Channel to report errors to Firebase Crashlytics
class CrashlyticsChannel : ReleaseChannel() {
override val filter: Filter = Filter.level(Level.ERROR)
override val id: Int = Channels.Crashlytics
override val default: Boolean = true
override fun print(line: Line) {
FirebaseCrashlytics.getInstance()
.log("${line.level.name} ${line.category}: ${line.message}")
line.throwable?.let { error ->
FirebaseCrashlytics.getInstance().recordException(error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment