1 /* 2 * Copyright (C) 2015 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 package com.android.phone.vvm; 17 18 import android.util.LocalLog; 19 import android.util.Log; 20 21 import com.android.internal.util.IndentingPrintWriter; 22 23 import java.io.FileDescriptor; 24 import java.io.PrintWriter; 25 26 /** 27 * Helper methods for adding to OMTP visual voicemail local logs. 28 */ 29 public class VvmLog { 30 31 private static final int MAX_OMTP_VVM_LOGS = 100; 32 33 private static final LocalLog sLocalLog = new LocalLog(MAX_OMTP_VVM_LOGS); 34 log(String tag, String log)35 public static void log(String tag, String log) { 36 sLocalLog.log(tag + ": " + log); 37 } 38 dump(FileDescriptor fd, PrintWriter printwriter, String[] args)39 public static void dump(FileDescriptor fd, PrintWriter printwriter, String[] args) { 40 IndentingPrintWriter indentingPrintWriter = new IndentingPrintWriter(printwriter, " "); 41 indentingPrintWriter.increaseIndent(); 42 sLocalLog.dump(fd, indentingPrintWriter, args); 43 indentingPrintWriter.decreaseIndent(); 44 } 45 e(String tag, String log)46 public static int e(String tag, String log) { 47 log(tag, log); 48 return Log.e(tag, log); 49 } 50 e(String tag, String log, Throwable e)51 public static int e(String tag, String log, Throwable e) { 52 log(tag, log + " " + e); 53 return Log.e(tag, log, e); 54 } 55 w(String tag, String log)56 public static int w(String tag, String log) { 57 log(tag, log); 58 return Log.w(tag, log); 59 } 60 w(String tag, String log, Throwable e)61 public static int w(String tag, String log, Throwable e) { 62 log(tag, log + " " + e); 63 return Log.w(tag, log, e); 64 } 65 i(String tag, String log)66 public static int i(String tag, String log) { 67 log(tag, log); 68 return Log.i(tag, log); 69 } 70 i(String tag, String log, Throwable e)71 public static int i(String tag, String log, Throwable e) { 72 log(tag, log + " " + e); 73 return Log.i(tag, log, e); 74 } 75 d(String tag, String log)76 public static int d(String tag, String log) { 77 log(tag, log); 78 return Log.d(tag, log); 79 } 80 d(String tag, String log, Throwable e)81 public static int d(String tag, String log, Throwable e) { 82 log(tag, log + " " + e); 83 return Log.d(tag, log, e); 84 } 85 v(String tag, String log)86 public static int v(String tag, String log) { 87 log(tag, log); 88 return Log.v(tag, log); 89 } 90 v(String tag, String log, Throwable e)91 public static int v(String tag, String log, Throwable e) { 92 log(tag, log + " " + e); 93 return Log.v(tag, log, e); 94 } 95 wtf(String tag, String log)96 public static int wtf(String tag, String log) { 97 log(tag, log); 98 return Log.wtf(tag, log); 99 } 100 wtf(String tag, String log, Throwable e)101 public static int wtf(String tag, String log, Throwable e) { 102 log(tag, log + " " + e); 103 return Log.wtf(tag, log, e); 104 } 105 } 106