Add log with default tag
This commit is contained in:
1 parent
f5551e4e0c
commit
19e70aacdf
1 file changed
+44
-2
@@ -19,10 +19,20 @@ import com.hippo.ehviewer.BuildConfig;
|
||||
|
||||
public class Log {
|
||||
|
||||
public static final String avoidNull(String str) {
|
||||
private static final String TAG = Log.class.getSimpleName();
|
||||
|
||||
private static final String avoidNull(String str) {
|
||||
return str == null ? TextUtils.STRING_NULL : str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call {@link android.util.Log#v(String, String)} with default tag.
|
||||
* @param msg The message you would like logged.
|
||||
*/
|
||||
public static int v(String msg) {
|
||||
return v(TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is {@link android.util.Log#v(String, String)}, only work when debug.
|
||||
* @param tag Used to identify the source of a log message. It usually identifies
|
||||
@@ -52,6 +62,14 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link android.util.Log#d(String, String)} with default tag.
|
||||
* @param msg The message you would like logged.
|
||||
*/
|
||||
public static int d(String msg) {
|
||||
return d(TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is {@link android.util.Log#d(String, String)}, only work when debug.
|
||||
* @param tag Used to identify the source of a log message. It usually identifies
|
||||
@@ -81,6 +99,14 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link android.util.Log#i(String, String)} with default tag.
|
||||
* @param msg The message you would like logged.
|
||||
*/
|
||||
public static int i(String msg) {
|
||||
return i(TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is {@link android.util.Log#i(String, String)}, only work when debug.
|
||||
* @param tag Used to identify the source of a log message. It usually identifies
|
||||
@@ -110,6 +136,14 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link android.util.Log#w(String, String)} with default tag.
|
||||
* @param msg The message you would like logged.
|
||||
*/
|
||||
public static int w(String msg) {
|
||||
return w(TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is {@link android.util.Log#w(String, String)}, only work when debug.
|
||||
* @param tag Used to identify the source of a log message. It usually identifies
|
||||
@@ -153,6 +187,14 @@ public class Log {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link android.util.Log#e(String, String)} with default tag.
|
||||
* @param msg The message you would like logged.
|
||||
*/
|
||||
public static int e(String msg) {
|
||||
return e(TAG, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is {@link android.util.Log#e(String, String)}, only work when debug.
|
||||
* @param tag Used to identify the source of a log message. It usually identifies
|
||||
|
||||
Reference in new issue
Block a user