本文整理了Java中com.orhanobut.logger.Logger.json()
方法的一些代码示例,展示了Logger.json()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.json()
方法的具体详情如下:
包路径:com.orhanobut.logger.Logger
类名称:Logger
方法名:json
[英]Formats the given json content and print it
[中]
代码示例来源:origin: jaydenxiao2016/AndroidFire
public static void logjson(String message) {
if (DEBUG_ENABLE) {
Logger.json(message);
}
}
public static void logxml(String message) {
代码示例来源:origin: GeekGhost/Ghost
/**
* debug 模式下,会打印json 数据
*
* @param messageForE
*/
public static void json(String messageForE) {
if (BuildConfig.DEBUG) {
Logger.json(messageForE);
}
}
代码示例来源:origin: orhanobut/logger
Logger.json("{ \"key\": 3, \"value\": something}");
代码示例来源:origin: dongjunkun/GanK
@Override
public void onResponse(Call call, Response response) throws IOException {
//获取String类型响应,注意是string(),不是toString()
final String json = response.body().string();
//在控制台格式化打印json数据
Logger.json(json);
handler.post(new Runnable() {
@Override
public void run() {
handleResponse(json, callBack, dbManager, url, isCache);
}
});
}
});
代码示例来源:origin: xiaoxiangyeyuHeaven/HeavenlyModule
public static void logjson(String message) {
if (DEBUG_ENABLE) {
Logger.json(message);
}
}
public static void logxml(String message) {
代码示例来源:origin: xiaolongonly/Ticket-Analysis
public static void json(String msg) {
if (sDebug) {
Logger.json(msg);
}
}
}
代码示例来源:origin: wangfeng19930909/BaseMVP-master
public static void logjson(String message) {
if (DEBUG_ENABLE) {
Logger.json(message);
}
}
public static void logxml(String message) {
代码示例来源:origin: flyve-mdm/android-mdm-agent
/**
* Send a JSON log message
* @param json String the json to show
*/
public static void json(String json) {
Logger.json(json);
}
代码示例来源:origin: 121880399/QuickMvp
@Override
public void json(String json) {
Logger.json(json);
}
代码示例来源:origin: gdutxiaoxu/CoordinatorLayoutExample
public static final void json(String msg) {
Logger.json(msg);
}
代码示例来源:origin: hanlyjiang/Demo-AndroidEChartWebJs
public static void json(String jsonStr) {
Logger.json(jsonStr);
}
代码示例来源:origin: xiaoyanger0825/LogHttpInfo
public static void json(String json) {
Logger.json(json);
}
}
代码示例来源:origin: Lauzy/TicktockMusic
public static void json(String content) {
if (BuildConfig.DEBUG && !TextUtils.isEmpty(content))
Logger.json(content);
}
代码示例来源:origin: ahmedeltaher/MVP-Sample
public static void json(String tag, String massage) {
if (BuildConfig.DEBUG) {
Logger.i(tag);
Logger.json(massage);
}
}
}
代码示例来源:origin: andyiac/githot
public static void json(String json) {
if (isDebuggable())
Logger.json(json);
}
代码示例来源:origin: andyiac/githot
public static void json(Object o) {
if (isDebuggable())
Logger.json(JSON.toJSONString(o));
}
代码示例来源:origin: szpnygo/NoWordsChat
@Override
public void getData(String response, HttpUtil.HttpDataListener listener) {
try {
JSONObject object = new JSONObject(response);
Logger.json(response);
int code = object.getInt("code");
if (code == 0) {
listener.success(response);
} else {
listener.error(code, object.getString("message"));
}
} catch (JSONException e) {
listener.error(ERROR_DATA_ERROR, e.getMessage());
}
}
};
代码示例来源:origin: yoyiyi/bilisoleil
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Logger.d(String.format("Sending request %s on %s%n%s",
request.url(), chain.connection(), request.headers()));
long t1 = System.nanoTime();
Response response = chain.proceed(chain.request());
long t2 = System.nanoTime();
Logger.d(String.format(Locale.getDefault(), "Received response for %s in %.1fms%n%s",
response.request().url(), (t2 - t1) / 1e6d, response.headers()));
MediaType mediaType = response.body().contentType();
String content = response.body().string();
Logger.json(content);
return response
.newBuilder()
.body(ResponseBody.create(mediaType, content))
.build();
}
}
代码示例来源:origin: hasancse91/Android-Development-Course
@Override
public void onResponse(@NonNull Call<MovieListResponse> call, @NonNull Response<MovieListResponse> response) {
Logger.d("Raw HTTP response: " + response.raw());
if(response.code()==200) {
MovieListResponse movieListResponse = response.body();
//Print response body in Log as JSON
Gson gson = new Gson();
String json = gson.toJson(movieListResponse, MovieListResponse.class);
Logger.json(json);
//End of JSON print in log
//If movie list found, load them to RecyclerView
if(movieListResponse!=null && !movieListResponse.getMovies().isEmpty()) {
recyclerViewAdapter = new RecyclerViewAdapter(movieListResponse.getMovies());
recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(recyclerViewAdapter);
} else
Toast.makeText(getApplicationContext(), "Movie list not found", Toast.LENGTH_LONG).show();
} else
Toast.makeText(getApplicationContext(), response.message(), Toast.LENGTH_LONG).show();
}
代码示例来源:origin: huangfangyi/YiChat
public static void json(String tag, String message) {
Logger.init(tag)
.methodCount(METHOD_COUNT)
.logLevel(LOG_LEVEL)
.methodOffset(METHOD_OFFSET);
Logger.json(message);
}
内容来源于网络,如有侵权,请联系作者删除!