logger
logger copied to clipboard
I want make it like you
I want to make one log util like you. It's yours It's mine I don't know why like this. How to make it like yours.
See #202 @zuoni1018 gived a solution. It works for me. But his text style seems to be some problem and I fix it:
private void initLogger() {
LogStrategy logStrategy = new LogStrategy() {
private String[] prefix = {". ", " ."};
private int index = 0;
@Override
public void log(int priority, @Nullable String tag, @NonNull String message) {
index = index ^ 1;
Log.println(priority, prefix[index] + tag, message);
}
};
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.logStrategy(logStrategy)
.showThreadInfo(false) // Optional
.methodCount(1) // Optional
.methodOffset(7)
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}