mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
parent
1996d8dc4a
commit
4656914203
|
@ -1,7 +1,5 @@
|
||||||
package one.nem.lacerta.utils;
|
package one.nem.lacerta.utils;
|
||||||
|
|
||||||
import one.nem.lacerta.utils.model.KeyValueLog;
|
|
||||||
|
|
||||||
public interface LacertaLogger {
|
public interface LacertaLogger {
|
||||||
|
|
||||||
void info(String tag, String message);
|
void info(String tag, String message);
|
||||||
|
@ -11,7 +9,4 @@ public interface LacertaLogger {
|
||||||
void trace(String tag, String message);
|
void trace(String tag, String message);
|
||||||
void fatal(String tag, String message);
|
void fatal(String tag, String message);
|
||||||
|
|
||||||
String buildMessageByObject(KeyValueLog... logs);
|
|
||||||
// With name
|
|
||||||
String buildMessageByObject(String name, KeyValueLog... logs);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ import android.util.Log;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import one.nem.lacerta.utils.LacertaLogger;
|
import one.nem.lacerta.utils.LacertaLogger;
|
||||||
import one.nem.lacerta.utils.model.KeyValueLog;
|
|
||||||
|
|
||||||
public class LacertaLoggerImpl implements LacertaLogger{
|
public class LacertaLoggerImpl implements LacertaLogger{
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -42,30 +40,4 @@ public class LacertaLoggerImpl implements LacertaLogger{
|
||||||
public void fatal(String tag, String message) {
|
public void fatal(String tag, String message) {
|
||||||
Log.wtf(tag, message);
|
Log.wtf(tag, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String buildMessageByObject(KeyValueLog... logs) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
for (KeyValueLog log : logs) {
|
|
||||||
builder.append(log.getKey());
|
|
||||||
builder.append(": ");
|
|
||||||
builder.append(log.getValue());
|
|
||||||
builder.append("\n");
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String buildMessageByObject(String name, KeyValueLog... logs) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(name);
|
|
||||||
builder.append("\n");
|
|
||||||
for (KeyValueLog log : logs) {
|
|
||||||
builder.append(log.getKey());
|
|
||||||
builder.append(": ");
|
|
||||||
builder.append(log.getValue());
|
|
||||||
builder.append("\n");
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user