Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create connector between Hyperlog and Timber #4

Open
mariopce opened this issue Dec 28, 2017 · 2 comments
Open

Create connector between Hyperlog and Timber #4

mariopce opened this issue Dec 28, 2017 · 2 comments

Comments

@mariopce
Copy link

Because in a project I'm using timber - and I don't want change all methods call, my proposition creates a small library which will connect hyperlog and timber. I just implement Timber.Tree.

@deano2390
Copy link

Agree, this is an obvious upgrade for this library

@brianjcoan
Copy link

I have the following class in my app:

import android.content.Context
import android.util.Log
import com.hypertrack.hyperlog.HyperLog
import timber.log.Timber.DebugTree

class HyperLogTree(
    context: Context,
    logLevel: Int = Log.DEBUG
) : DebugTree() {
    init {
        HyperLog.initialize(context)
        HyperLog.setLogLevel(logLevel)
    }

    override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
        when (priority) {
            Log.VERBOSE -> HyperLog.v(tag, message, t)
            Log.DEBUG -> HyperLog.d(tag, message, t)
            Log.INFO -> HyperLog.i(tag, message, t)
            Log.WARN -> HyperLog.w(tag, message, t)
            Log.ERROR -> HyperLog.e(tag, message, t)
        }
    }
}

and call it from the Application class:
Timber.plant(CrashlyticsTree(), HyperLogTree(this, Log.INFO))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants