Skip to content
Muyangmin edited this page Feb 23, 2017 · 10 revisions

Welcome to the Android-PLog wiki!

Please click links from the right side bar to read what you are interested in.

Steps to use PLog

1.Import via gradle,

currently the latest version is Download

    compile 'org.mym.plog:android-plog:${latestVersion}'

For dependencies of other modules, please click here.

2.Prepare printers(RECOMMENDED)

Since you may need to intercept or redirect logs, in PLog 2.x version, we recommend you to prepare printers manually.

//all logs will be automatically disabled on release version
PLog.prepare(new DebugPrinter(BuildConfig.DEBUG));

Don't worry, if you forgot this, your app won't crash. You will just receive a WARNING message on the runtime, then all logs will be print to logcat only.

You can also put your customize configs before printing any logs:

PLog.init(PLogConfig.newBuilder()
        .globalTag("MyApp")
        .forceConcatGlobalTag(true)
        .build());

3.Just enjoy it!

Now you can use PLog class to print log, via v(), d(), i() method, and so on. Sample:

    //Empty message    
    PLog.empty();

    //log with auto tag
    PLog.v("This is a verbose log.");
    PLog.e("This is an error log.");

    //Advanced usage
    PLog.level(Log.DEBUG).tag("Scenario").category("RESULT").message("You win!").execute();

For more sample codes please see app module on this repository.

Clone this wiki locally