Skip to content

Commit

Permalink
Merge pull request #130 from orhanobut/fix-debug-null
Browse files Browse the repository at this point in the history
Fix Logger.d(null)
  • Loading branch information
orhanobut committed Jun 6, 2017
2 parents a5bcc3f + d847dea commit eb20ae8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Simple, pretty and powerful logger for android
### Setup
Download
```groovy
compile 'com.orhanobut:logger:2.1.0'
compile 'com.orhanobut:logger:2.1.1'
```

Initialize
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=2.1.0
VERSION_NAME=2.1.1
GROUP=com.orhanobut

POM_DESCRIPTION=Simple, Pretty and Advanced Logger
Expand Down
3 changes: 3 additions & 0 deletions logger/src/main/java/com/orhanobut/logger/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ static String logLevel(int value) {
}

public static String toString(Object object) {
if (object == null) {
return "null";
}
if (!object.getClass().isArray()) {
return object.toString();
}
Expand Down
4 changes: 4 additions & 0 deletions logger/src/test/java/com.orhanobut.logger/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public class UtilsTest {
assertThat(Utils.toString(object)).isEqualTo("Test");
}

@Test public void toStringWithNull() {
assertThat(Utils.toString(null)).isEqualTo("null");
}

@Test public void primitiveArrayToString() {
Object booleanArray = new boolean[]{true, false, true};
assertThat(Utils.toString(booleanArray)).isEqualTo("[true, false, true]");
Expand Down

0 comments on commit eb20ae8

Please sign in to comment.