final String method = JsonUtils.getAsString(jsonObj, "method");
final String file = JsonUtils.getAsString(jsonObj, "file");
final String line = JsonUtils.getAsString(jsonObj, "line");
final String thread = JsonUtils.getAsString(jsonObj, "thread");
final String message = JsonUtils.getAsString(jsonObj, "message");
final LogThrowable logThrowable = context.deserialize(jsonObj.get("throwable"), LogThrowable.class);
return new LogEntry() {
@Override
public String getLoggerName() {
return name;
}
@Override
public String getHost() {
return host;
}
@Override
public long getTimestamp() {
return timestamp;
}
@Override
public Level getLogLevel() {
return logLevel;
}
@Override
public String getSourceClassName() {
return className;
}
@Override
public String getSourceMethodName() {
return method;
}
@Override
public String getFileName() {
return file;
}
@Override
public int getLineNumber() {
if (line.equals("?")) {
return -1;
} else {
return Integer.parseInt(line);
}
}
@Override
public String getThreadName() {
return thread;
}
@Override
public String getMessage() {
return message;
}
@Override
public LogThrowable getThrowable() {
return logThrowable;
}
@Override
public StackTraceElement[] getStackTraces() {
LogThrowable throwable = getThrowable();
return (throwable == null) ? EMPTY_STACK_TRACES : throwable.getStackTraces();
}
};
}