1 /* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package org.apache.james.mime4j; 18 19 import com.android.email.Email; 20 21 /** 22 * Empty stub for the apache logging library. 23 */ 24 public class Log { Log(Class mClazz)25 public Log(Class mClazz) { 26 } 27 isDebugEnabled()28 public boolean isDebugEnabled() { 29 return Email.LOGD; 30 } 31 isErrorEnabled()32 public boolean isErrorEnabled() { 33 return true; 34 } 35 isFatalEnabled()36 public boolean isFatalEnabled() { 37 return true; 38 } 39 isInfoEnabled()40 public boolean isInfoEnabled() { 41 return Email.LOGD; 42 } 43 isTraceEnabled()44 public boolean isTraceEnabled() { 45 return Email.LOGD; 46 } 47 isWarnEnabled()48 public boolean isWarnEnabled() { 49 return true; 50 } 51 trace(Object message)52 public void trace(Object message) { 53 if (!isTraceEnabled()) return; 54 android.util.Log.v(Email.LOG_TAG, toString(message, null)); 55 } 56 trace(Object message, Throwable t)57 public void trace(Object message, Throwable t) { 58 if (!isTraceEnabled()) return; 59 android.util.Log.v(Email.LOG_TAG, toString(message, t)); 60 } 61 debug(Object message)62 public void debug(Object message) { 63 if (!isDebugEnabled()) return; 64 android.util.Log.d(Email.LOG_TAG, toString(message, null)); 65 } 66 debug(Object message, Throwable t)67 public void debug(Object message, Throwable t) { 68 if (!isDebugEnabled()) return; 69 android.util.Log.d(Email.LOG_TAG, toString(message, t)); 70 } 71 info(Object message)72 public void info(Object message) { 73 if (!isInfoEnabled()) return; 74 android.util.Log.i(Email.LOG_TAG, toString(message, null)); 75 } 76 info(Object message, Throwable t)77 public void info(Object message, Throwable t) { 78 if (!isInfoEnabled()) return; 79 android.util.Log.i(Email.LOG_TAG, toString(message, t)); 80 } 81 warn(Object message)82 public void warn(Object message) { 83 android.util.Log.w(Email.LOG_TAG, toString(message, null)); 84 } 85 warn(Object message, Throwable t)86 public void warn(Object message, Throwable t) { 87 android.util.Log.w(Email.LOG_TAG, toString(message, t)); 88 } 89 error(Object message)90 public void error(Object message) { 91 android.util.Log.e(Email.LOG_TAG, toString(message, null)); 92 } 93 error(Object message, Throwable t)94 public void error(Object message, Throwable t) { 95 android.util.Log.e(Email.LOG_TAG, toString(message, t)); 96 } 97 fatal(Object message)98 public void fatal(Object message) { 99 android.util.Log.e(Email.LOG_TAG, toString(message, null)); 100 } 101 fatal(Object message, Throwable t)102 public void fatal(Object message, Throwable t) { 103 android.util.Log.e(Email.LOG_TAG, toString(message, t)); 104 } 105 toString(Object o, Throwable t)106 private static String toString(Object o, Throwable t) { 107 String m = (o == null) ? "(null)" : o.toString(); 108 if (t == null) { 109 return m; 110 } else { 111 return m + " " + t.getMessage(); 112 } 113 } 114 } 115