Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
michael@0 | 1 | package ch.boye.httpclientandroidlib.androidextra; |
michael@0 | 2 | |
michael@0 | 3 | import android.util.Log; |
michael@0 | 4 | |
michael@0 | 5 | public class HttpClientAndroidLog { |
michael@0 | 6 | |
michael@0 | 7 | private String logTag; |
michael@0 | 8 | private boolean debugEnabled; |
michael@0 | 9 | private boolean errorEnabled; |
michael@0 | 10 | private boolean warnEnabled; |
michael@0 | 11 | private boolean infoEnabled; |
michael@0 | 12 | |
michael@0 | 13 | public HttpClientAndroidLog(Object tag) { |
michael@0 | 14 | logTag=tag.toString(); |
michael@0 | 15 | debugEnabled=false; |
michael@0 | 16 | errorEnabled=false; |
michael@0 | 17 | warnEnabled=false; |
michael@0 | 18 | infoEnabled=false; |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | public void enableDebug(boolean enable) { |
michael@0 | 22 | debugEnabled=enable; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | public boolean isDebugEnabled() { |
michael@0 | 26 | return debugEnabled; |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | public void debug(Object message) { |
michael@0 | 30 | Log.d(logTag, message.toString()); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | public void debug(Object message, Throwable t) { |
michael@0 | 34 | Log.d(logTag, message.toString(), t); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | public void enableError(boolean enable) { |
michael@0 | 38 | errorEnabled=enable; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | public boolean isErrorEnabled() { |
michael@0 | 42 | return errorEnabled; |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | public void error(Object message) { |
michael@0 | 46 | Log.e(logTag, message.toString()); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | public void error(Object message, Throwable t) { |
michael@0 | 50 | Log.e(logTag, message.toString(), t); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | public void enableWarn(boolean enable) { |
michael@0 | 54 | warnEnabled=enable; |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | public boolean isWarnEnabled() { |
michael@0 | 58 | return warnEnabled; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | public void warn(Object message) { |
michael@0 | 62 | Log.w(logTag, message.toString()); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | public void warn(Object message, Throwable t) { |
michael@0 | 66 | Log.w(logTag, message.toString(), t); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | public void enableInfo(boolean enable) { |
michael@0 | 70 | infoEnabled=enable; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | public boolean isInfoEnabled() { |
michael@0 | 74 | return infoEnabled; |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | public void info(Object message) { |
michael@0 | 78 | Log.i(logTag, message.toString()); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | public void info(Object message, Throwable t) { |
michael@0 | 82 | Log.i(logTag, message.toString(), t); |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | } |