-
Notifications
You must be signed in to change notification settings - Fork 31
Home
Please click links from the right side bar to read what you are interested in.
If you found any wiki error(e.g. dependency error, api missing, etc), please feel free to pick an issue to me!
Currently the latest version is
compile 'org.mym.plog:plog-core:${latestVersion}'
//IMPORTANT TIPS: the artifactId for 1.x version is `android-plog`.
//So if you want to use 1.x version(NOT RECOMMENDED),
//please import using following dependency:
//compile 'org.mym.plog:android-plog:1.7.0'
Note: This is jcenter dependency grammar; if you use GitPack only, please check here to get it.
For dependencies of other modules, please click here.
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));
//NOTE: Make sure BuildConfig class is belong to your own app package, not in any library!
// If you do not want it to intercept any logs, you can just pass a `true` into the constructor.
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());
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")
.msg("You win!").execute();
For more sample codes please see app
module on this repository.