-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathELog.java
More file actions
56 lines (47 loc) · 1.44 KB
/
ELog.java
File metadata and controls
56 lines (47 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import android.util.Log;
public class ELog {
// when online set this value to false
public static boolean debugeMode = BuildConfig.DEBUG;
// you can set this TAG
// notice that if you change it , all log will change to the tag you seted
public static String TAG = "MYLOG";
private ELog() {
}
private static String getString(Object object) {
StackTraceElement ste = new Throwable().getStackTrace()[2];
String valueString = ste.getFileName() + " "
+ ste.getMethodName() + ":" + ste.getLineNumber() + " "
+ ((object == null) ? "NULL" : object.toString());
return valueString;
}
public static void e(Object object) {
if (debugeMode) {
Log.e(TAG, getString(object));
}
}
public static void i(Object object) {
if (debugeMode) {
Log.i(TAG, getString(object));
}
}
public static void d(Object object) {
if (debugeMode) {
Log.d(TAG, getString(object));
}
}
public static void e(String tag,Object object) {
if (debugeMode) {
Log.e(tag, getString(object));
}
}
public static void i(String tag,Object object) {
if (debugeMode) {
Log.i(tag, getString(object));
}
}
public static void d(String tag,Object object) {
if (debugeMode) {
Log.d(tag, getString(object));
}
}
}