forked from shogo4405/HaishinKit.kt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
301 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
app/src/main/java/com/haishinkit/util/AndroidLogAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.haishinkit.util; | ||
|
||
import android.util.Log; | ||
|
||
public final class AndroidLogAdapter implements ILogAdapter { | ||
public int v(String tag, String msg) { | ||
return Log.v(tag, msg); | ||
} | ||
|
||
public int v(String tag, String msg, Throwable tr) { | ||
return Log.v(tag, msg, tr); | ||
} | ||
|
||
public int d(String tag, String msg) { | ||
return Log.d(tag, msg); | ||
} | ||
|
||
public int d(String tag, String msg, Throwable tr) { | ||
return Log.d(tag, msg, tr); | ||
} | ||
|
||
public int i(String tag, String msg) { | ||
return Log.i(tag, msg); | ||
} | ||
|
||
public int i(String tag, String msg, Throwable tr) { | ||
return Log.i(tag, msg, tr); | ||
} | ||
|
||
public int w(String tag, String msg) { | ||
return Log.w(tag, msg); | ||
} | ||
|
||
public int w(String tag, String msg, Throwable tr) { | ||
return Log.w(tag, msg, tr); | ||
} | ||
|
||
public int w(String tag, Throwable tr) { | ||
return Log.w(tag, tr); | ||
} | ||
|
||
public int e(String tag, String msg) { | ||
return Log.e(tag, msg); | ||
} | ||
|
||
public int e(String tag, String msg, Throwable tr) { | ||
return Log.e(tag, msg, tr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.haishinkit.util; | ||
|
||
public interface ILogAdapter { | ||
public int v(String tag, String msg); | ||
public int v(String tag, String msg, Throwable tr); | ||
public int d(String tag, String msg); | ||
public int d(String tag, String msg, Throwable tr); | ||
public int i(String tag, String msg); | ||
public int i(String tag, String msg, Throwable tr); | ||
public int w(String tag, String msg); | ||
public int w(String tag, String msg, Throwable tr); | ||
public int w(String tag, Throwable tr); | ||
public int e(String tag, String msg); | ||
public int e(String tag, String msg, Throwable tr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.haishinkit.util; | ||
|
||
public final class Log { | ||
private static ILogAdapter adapter = new SystemLogAdapter(); | ||
|
||
static { | ||
String runtime = System.getProperty("java.runtime.name"); | ||
if (0 <= runtime.indexOf("Android")) { | ||
adapter = new AndroidLogAdapter(); | ||
} | ||
} | ||
|
||
public static int v(String tag, String msg) { | ||
return adapter.v(tag, msg); | ||
} | ||
|
||
public static int v(String tag, String msg, Throwable tr) { | ||
return adapter.v(tag, msg, tr); | ||
} | ||
|
||
public static int d(String tag, String msg) { | ||
return adapter.v(tag, msg); | ||
} | ||
|
||
public static int d(String tag, String msg, Throwable tr) { | ||
return adapter.d(tag, msg, tr); | ||
} | ||
|
||
public static int i(String tag, String msg) { | ||
return adapter.i(tag, msg); | ||
} | ||
|
||
public static int i(String tag, String msg, Throwable tr) { | ||
return adapter.i(tag, msg, tr); | ||
} | ||
|
||
public static int w(String tag, String msg) { | ||
return adapter.w(tag, msg); | ||
} | ||
|
||
public static int w(String tag, String msg, Throwable tr) { | ||
return adapter.w(tag, msg, tr); | ||
} | ||
|
||
public static int w(String tag, Throwable tr) { | ||
return adapter.w(tag, tr); | ||
} | ||
|
||
public static int e(String tag, String msg) { | ||
return adapter.e(tag, msg); | ||
} | ||
|
||
public static int e(String tag, String msg, Throwable tr) { | ||
return adapter.e(tag, msg, tr); | ||
} | ||
} |
Oops, something went wrong.