1 /* 2 * Copyright (C) 2010 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 com.replica.replicaisland; 18 19 import android.util.Log; 20 21 public final class DebugLog { 22 private static boolean mLoggingEnabled = true; 23 24 private DebugLog() { 25 26 } 27 28 public static void setDebugLogging(boolean enabled) { 29 mLoggingEnabled = enabled; 30 } 31 32 public static int v(String tag, String msg) { 33 int result = 0; 34 if (mLoggingEnabled) { 35 result = Log.v(tag, msg); 36 } 37 return result; 38 } 39 40 public static int v(String tag, String msg, Throwable tr) { 41 int result = 0; 42 if (mLoggingEnabled) { 43 result = Log.v(tag, msg, tr); 44 } 45 return result; 46 } 47 48 public static int d(String tag, String msg) { 49 int result = 0; 50 if (mLoggingEnabled) { 51 result = Log.d(tag, msg); 52 } 53 return result; 54 } 55 56 public static int d(String tag, String msg, Throwable tr) { 57 int result = 0; 58 if (mLoggingEnabled) { 59 result = Log.d(tag, msg, tr); 60 } 61 return result; 62 } 63 64 public static int i(String tag, String msg) { 65 int result = 0; 66 if (mLoggingEnabled) { 67 result = Log.i(tag, msg); 68 } 69 return result; 70 } 71 72 public static int i(String tag, String msg, Throwable tr) { 73 int result = 0; 74 if (mLoggingEnabled) { 75 result = Log.i(tag, msg, tr); 76 } 77 return result; 78 } 79 80 public static int w(String tag, String msg) { 81 int result = 0; 82 if (mLoggingEnabled) { 83 result = Log.w(tag, msg); 84 } 85 return result; 86 } 87 88 public static int w(String tag, String msg, Throwable tr) { 89 int result = 0; 90 if (mLoggingEnabled) { 91 result = Log.w(tag, msg, tr); 92 } 93 return result; 94 } 95 96 public static int w(String tag, Throwable tr) { 97 int result = 0; 98 if (mLoggingEnabled) { 99 result = Log.w(tag, tr); 100 } 101 return result; 102 } 103 104 public static int e(String tag, String msg) { 105 int result = 0; 106 if (mLoggingEnabled) { 107 result = Log.e(tag, msg); 108 } 109 return result; 110 } 111 112 public static int e(String tag, String msg, Throwable tr) { 113 int result = 0; 114 if (mLoggingEnabled) { 115 result = Log.e(tag, msg, tr); 116 } 117 return result; 118 } 119 } 120