Installation for Android

Add jitpack to your project build.gradle

allprojects {
    repositories {
        ...
        maven { url 'https://www.jitpack.io' }
    }
}

Add Birch to your app build.gradle

implementation 'com.ryanfung.birch-android:birch:1.8.0'

If you use Timber, you can also use the following:

implementation 'com.ryanfung.birch-android:birch-timber:1.8.0'

Initializing the logger

In your application class, initialize the logger.

class MyApp: Application() {

  override fun onCreate() {
    super.onCreate()

    // This is a sample of how you might want to configure the logger between development and production builds.
    if (BuildConfig.DEBUG) {
      Birch.level = Level.TRACE // This overrides the server configuration during local development. The default is null.
      Birch.synchronous = true // This makes the logger log synchronously. The default is false.
    } else {
      Birch.console = false // Disable console logging in production.
    }

    Birch.debug = true // This line should be removed after you've successfully integrated. It is only used to help you debug the integration if you're having issues.
    Birch.init(this, "YOUR_API_KEY", "YOUR_PUBLIC_ENCRYPTION_KEY")
    Birch.identifier = "your_user_id" // this is optional but highly recommended
  }
}

Logging

Use the logger as you would with logcat.

Birch.t("trace message") // simplest
Birch.t { "trace message" } // most performant especially if it's expensive to build the log message.

Birch.d("debug message")
Birch.d { "debug message" }

Birch.i("info message")
Birch.i { "info message" }

Birch.w("warn message")
Birch.w { "warn message" }

Birch.e("error message")
Birch.e { "error message" }

Bindings