public final class PLog extends Object
Modifier and Type | Method and Description |
---|---|
static void |
appendPrinter(Printer printer)
Append an extra printer to currently printer collection.
|
static LogRequest
|
category(Category category)
|
static LogRequest
|
category(String category)
|
static void |
d(String msg,
Object... params)
|
static void |
e(String msg,
Object... params)
|
static void |
empty()
Print a predefined message using a predefined level.
|
static PLogConfig
|
getCurrentConfig()
Get current config, useful for temporarily change config and
backup then.
|
static void |
i(String msg,
Object... params)
|
static void |
init(PLogConfig config)
Init PLog using customized config.
|
static void |
json(JSONObject jsonObject)
Deprecated.
use
objects(Object...) instead.
|
static LogRequest
|
level(int level)
|
static void |
objects(Object... params)
A recommended helper method useful when you just want to print
objects using default format.
|
static void |
prepare(Printer... printers)
Prepare printers; this method should always be called on
application start because you should
set your own onIntercept logic using
Printer interface.
|
static void |
printStackTraceHere()
A helper method to print a PLOG call stack trace here.
|
static LogRequest
|
tag(String tag)
|
static void |
throwable(Throwable throwable)
Print exceptions in WARN level.
|
static void |
v(String msg,
Object... params)
|
static void |
w(String msg,
Object... params)
|
static void |
wtf(Throwable throwable)
What a Terrible Failure: Report an exception that should never
happen.
|
public static void init(PLogConfig config)
@NonNull public static PLogConfig getCurrentConfig()
init(PLogConfig)
is not called yet.
init(PLogConfig)
public static LogRequest category(String category)
public static LogRequest category(@NonNull Category category)
public static LogRequest level(int level)
public static LogRequest tag(@NonNull String tag)
public static void empty()
public static void printStackTraceHere()
public static void objects(Object... params)
Log.DEBUG
.
params
- objects to print.public static void json(JSONObject jsonObject)
objects(Object...)
instead.
public static void throwable(Throwable throwable)
public static void wtf(Throwable throwable)
public static void prepare(Printer... printers)
Printer
interface.
PLog.prepare(new DebugPrinter(BuildConfig.DEBUG));
Note that calling this method will clear all printers set before.
printers
- printers to print logs; they are parallel from each
other.