Android-Clog

项目地址:JavaEden/Android-Clog
简介:Clog logger implementation for the standard Android Log
更多:作者   提 Bug   官网   
标签:

Clog logger implementation for the standard Android Log priorities

See https://github.com/JavaEden/Clog for information on Clog.

Android Clog Implementation

Android Clog provides simple Android Log implementations for Clog. The mapping between Clog levels and Android Clog levels is one-to-one, as the Clog API was designed to directly replace Log:

Clog.d(...) --> Log.d(...)

Clog.e(...) --> Log.e(...)

Clog.i(...) --> Log.i(...)

Clog.v(...) --> Log.v(...)

Clog.w(...) --> Log.w(...)

Clog.wtf(...) --> Log.wtf(...)

In addition, Clog tags work exactly like Android Log tags, like so:

d(String tag, String message) {
  Log.d(tag, message);
}

Getting Android Clog integrated into your project is easy. Add the following to your Activity's onCreate():

if(BuildConfig.DEBUG) {
    Clog.setCurrentProfile("dev", AndroidClog.getDevelopmentClog());
}
else {
    Clog.setCurrentProfile("prod", AndroidClog.getProductionClog());
}

In development, all logs will be directed to the standard Log implementations shown above, but in production, all logs will be discarded. You can replace the production log profile with implementations that write to file or send to Crashlytics if you need that instead.

Download

Clog and Android Clog is distrubuted through JitPack.io.

JitPack Javadoc

In your project-level build.gradle:

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

In your module's build.gradle (replace the version with the most recent release shown on badge above):

dependencies {
    ...
    compile('com.github.JavaEden:Android-Clog:v1.2.4@aar') {
        transitive = true;
    }
}
Android 开发经验分享
用了一年多的理财推荐
Android 开发经验分享
用了一年多的理财推荐