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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
package ch.boye.httpclientandroidlib.androidextra;
import android.util.Log;
public class HttpClientAndroidLog {
private String logTag;
private boolean debugEnabled;
private boolean errorEnabled;
private boolean traceEnabled;
private boolean warnEnabled;
private boolean infoEnabled;
public HttpClientAndroidLog(Object tag) {
logTag=tag.toString();
debugEnabled=false;
errorEnabled=false;
traceEnabled=false;
warnEnabled=false;
infoEnabled=false;
}
public void enableDebug(boolean enable) {
debugEnabled=enable;
}
public boolean isDebugEnabled() {
return debugEnabled;
}
public void debug(Object message) {
if(isDebugEnabled())
Log.d(logTag, message.toString());
}
public void debug(Object message, Throwable t) {
if(isDebugEnabled())
Log.d(logTag, message.toString(), t);
}
public void enableError(boolean enable) {
errorEnabled=enable;
}
public boolean isErrorEnabled() {
return errorEnabled;
}
public void error(Object message) {
if(isErrorEnabled())
Log.e(logTag, message.toString());
}
public void error(Object message, Throwable t) {
if(isErrorEnabled())
Log.e(logTag, message.toString(), t);
}
public void enableWarn(boolean enable) {
warnEnabled=enable;
}
public boolean isWarnEnabled() {
return warnEnabled;
}
public void warn(Object message) {
if(isWarnEnabled())
Log.w(logTag, message.toString());
}
public void warn(Object message, Throwable t) {
if(isWarnEnabled())
Log.w(logTag, message.toString(), t);
}
public void enableInfo(boolean enable) {
infoEnabled=enable;
}
public boolean isInfoEnabled() {
return infoEnabled;
}
public void info(Object message) {
if(isInfoEnabled())
Log.i(logTag, message.toString());
}
public void info(Object message, Throwable t) {
if(isInfoEnabled())
Log.i(logTag, message.toString(), t);
}
public void enableTrace(boolean enable) {
traceEnabled=enable;
}
public boolean isTraceEnabled() {
return traceEnabled;
}
public void trace(Object message) {
if(isTraceEnabled())
Log.i(logTag, message.toString());
}
public void trace(Object message, Throwable t) {
if(isTraceEnabled())
Log.i(logTag, message.toString(), t);
}
}
|