Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.
Imporve AndroidPrinter and make long message more readable. #20
Sample code
XLog.i(bundle); // Print a bundle details XLog.i(intent); // Print a intent details
Usage
LogUtils.compress(String folderPath, String zipFilePath)
log(int logLevel, …)
APIs #18Sample code
XLog.log(LogLevel.DEBUG, "sample message") // Print a DEBUG level log XLog.log(7, "sample message") // Print a level 7 log, which is higher than LogLevel.ERROR(6)
st(String stackTraceOrigin, int depth)
#17Sample code
XLog.st("LogWrapper", 5);
Interceptor
and LogNotification.Builder.addInterceptor(Interceptor)
NeverBackupStrategy
for file loggingBlacklistTagsFilterInterceptor
and WhitelistTagsFilterInterceptor
. Besides, you can easily define a filter interceptor extending AbstractFilterInterceptor
Flattener
instead of LogFlattener
DefaultFlattener
instead of DefaultLogFlattener
PatternFlattener
and ClassicFlattener
PatternFlattener
flatten the log using the format specified by pattern
Supported parameters:
Parameter | Represents |
---|---|
{d} | Date in default date format "yyyy-MM-dd HH:mm:ss.SSS" |
{d format} | Date in specific date format |
{l} | Short name of log level. e.g: V/D/I |
{L} | Long name of log level. e.g: VERBOSE/DEBUG/INFO |
{t} | Tag of log |
{m} | Message of log |
Imagine there is a log, with LogLevel.DEBUG
level, my_tag
tag and Simple message
message, the flattened log would be as below.
Pattern | Flattened log |
---|---|
{d} {l}/{t}: {m} | 2016-11-30 13:00:00.000 D/my_tag: Simple message |
{d yyyy-MM-dd HH:mm:ss.SSS} {l}/{t}: {m} | 2016-11-30 13:00:00.000 D/my_tag: Simple message |
{d yyyy/MM/dd HH:mm:ss} {l}|{t}: {m} | 2016/11/30 13:00:00 D|my_tag: Simple message |
{d yy/MM/dd HH:mm:ss} {l}|{t}: {m} | 16/11/30 13:00:00 D|my_tag: Simple message |
{d MM/dd HH:mm} {l}-{t}-{m} | 11/30 13:00 D-my_tag-Simple message |
ClassicFlattener
flatten the log using the pattern {d} {l}/{t}: {m}
LogNotification.Builder.logLevel(int logLevel)
XLog
XLog.init()
XLog.init(LogConfiguration)
XLog.init(Printer...)
XLog.init(LogConfiguration, Printer...)
init(int, LogConfiguration)
init(int, LogConfiguration, Printer...)
ConsolePrinter
instead of SystemPrinter
Fix an API typo: FilePrinter.Builder.logFormatter -> FilePrinter.Builder.logFlattener