From 8ef1e6bd213d59d701d70bdccadcbbcdb5354a06 Mon Sep 17 00:00:00 2001 From: orhanobut Date: Mon, 13 Apr 2015 12:44:17 +0200 Subject: [PATCH] v1.8 --- README.md | 2 +- gradle.properties | 4 ++-- .../com/orhanobut/logger/LoggerPrinter.java | 20 +++++++------------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index ea4199b1..b11367ea 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Logger provides : ### Gradle ```groovy -compile 'com.orhanobut:logger:1.7' +compile 'com.orhanobut:logger:1.8' ``` ### Current Log system diff --git a/gradle.properties b/gradle.properties index ff4c632a..2720b1d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,8 +18,8 @@ # org.gradle.parallel=true #VERSION_NAME=1.0-SNAPSHOT -VERSION_NAME=1.7 -VERSION_CODE=8 +VERSION_NAME=1.8 +VERSION_CODE=9 GROUP=com.orhanobut POM_DESCRIPTION=Simple,pretty and powerful log diff --git a/logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java b/logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java index f96260e6..fa46b603 100644 --- a/logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java +++ b/logger/src/main/java/com/orhanobut/logger/LoggerPrinter.java @@ -150,27 +150,24 @@ public void wtf(String message, Object... args) { */ @Override public void json(String json) { - String tag = getTag(); - int methodCount = getMethodCount(); - if (TextUtils.isEmpty(json)) { - d(tag, "Empty/Null json content", methodCount); + d("Empty/Null json content"); return; } try { if (json.startsWith("{")) { JSONObject jsonObject = new JSONObject(json); String message = jsonObject.toString(JSON_INDENT); - d(tag, message, methodCount); + d(message); return; } if (json.startsWith("[")) { JSONArray jsonArray = new JSONArray(json); String message = jsonArray.toString(JSON_INDENT); - d(tag, message, methodCount); + d(message); } } catch (JSONException e) { - d(tag, e.getCause().getMessage() + "\n" + json, methodCount); + e(e.getCause().getMessage() + "\n" + json); } } @@ -181,13 +178,10 @@ public void json(String json) { */ @Override public void xml(String xml) { - String tag = getTag(); - int methodCount = getMethodCount(); if (TextUtils.isEmpty(xml)) { - d(tag, "Empty/Null xml content", methodCount); + d("Empty/Null xml content"); return; } - try { Source xmlInput = new StreamSource(new StringReader(xml)); StreamResult xmlOutput = new StreamResult(new StringWriter()); @@ -195,9 +189,9 @@ public void xml(String xml) { transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); transformer.transform(xmlInput, xmlOutput); - d(tag, xmlOutput.getWriter().toString().replaceFirst(">", ">\n"), methodCount); + d(xmlOutput.getWriter().toString().replaceFirst(">", ">\n")); } catch (TransformerException e) { - d(tag, e.getCause().getMessage() + "\n" + xml, methodCount); + e(e.getCause().getMessage() + "\n" + xml); } }