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.mail.utils.LogUtils;
20 
21 /**
22  * Empty stub for the apache logging library.
23  */
24 public class Log {
25     private static final String LOG_TAG = LogUtils.TAG;
26 
Log(Class mClazz)27     public Log(Class mClazz) {
28     }
29 
isDebugEnabled()30     public boolean isDebugEnabled() {
31         return false;
32     }
33 
isErrorEnabled()34     public boolean isErrorEnabled() {
35         return true;
36     }
37 
isFatalEnabled()38     public boolean isFatalEnabled() {
39         return true;
40     }
41 
isInfoEnabled()42     public boolean isInfoEnabled() {
43         return false;
44     }
45 
isTraceEnabled()46     public boolean isTraceEnabled() {
47         return false;
48     }
49 
isWarnEnabled()50     public boolean isWarnEnabled() {
51         return true;
52     }
53 
trace(Object message)54     public void trace(Object message) {
55         if (!isTraceEnabled()) return;
56         android.util.Log.v(LOG_TAG, toString(message, null));
57     }
58 
trace(Object message, Throwable t)59     public void trace(Object message, Throwable t) {
60         if (!isTraceEnabled()) return;
61         android.util.Log.v(LOG_TAG, toString(message, t));
62     }
63 
debug(Object message)64     public void debug(Object message) {
65         if (!isDebugEnabled()) return;
66         android.util.Log.d(LOG_TAG, toString(message, null));
67     }
68 
debug(Object message, Throwable t)69     public void debug(Object message, Throwable t) {
70         if (!isDebugEnabled()) return;
71         android.util.Log.d(LOG_TAG, toString(message, t));
72     }
73 
info(Object message)74     public void info(Object message) {
75         if (!isInfoEnabled()) return;
76         android.util.Log.i(LOG_TAG, toString(message, null));
77     }
78 
info(Object message, Throwable t)79     public void info(Object message, Throwable t) {
80         if (!isInfoEnabled()) return;
81         android.util.Log.i(LOG_TAG, toString(message, t));
82     }
83 
warn(Object message)84     public void warn(Object message) {
85         android.util.Log.w(LOG_TAG, toString(message, null));
86     }
87 
warn(Object message, Throwable t)88     public void warn(Object message, Throwable t) {
89         android.util.Log.w(LOG_TAG, toString(message, t));
90     }
91 
error(Object message)92     public void error(Object message) {
93         android.util.Log.e(LOG_TAG, toString(message, null));
94     }
95 
error(Object message, Throwable t)96     public void error(Object message, Throwable t) {
97         android.util.Log.e(LOG_TAG, toString(message, t));
98     }
99 
fatal(Object message)100     public void fatal(Object message) {
101         android.util.Log.e(LOG_TAG, toString(message, null));
102     }
103 
fatal(Object message, Throwable t)104     public void fatal(Object message, Throwable t) {
105         android.util.Log.e(LOG_TAG, toString(message, t));
106     }
107 
toString(Object o, Throwable t)108     private static String toString(Object o, Throwable t) {
109         String m = (o == null) ? "(null)" : o.toString();
110         if (t == null) {
111             return m;
112         } else {
113             return m + " " + t.getMessage();
114         }
115     }
116 }
117