Rlog.java revision 599a90c2a02645a5f2d189b9065b863397a4076e
1/* 2 * Copyright (C) 2012 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 17package android.telephony; 18 19import com.android.internal.os.RuntimeInit; 20 21import android.util.Log; 22 23import java.io.PrintWriter; 24import java.io.StringWriter; 25 26/** 27 * A class to log strings to the RADIO LOG. 28 * 29 * @hide 30 */ 31public final class Rlog { 32 33 private Rlog() { 34 } 35 36 public static int v(String tag, String msg) { 37 return Log.println_native(Log.LOG_ID_RADIO, Log.VERBOSE, tag, msg); 38 } 39 40 public static int v(String tag, String msg, Throwable tr) { 41 return Log.println_native(Log.LOG_ID_RADIO, Log.VERBOSE, tag, 42 msg + '\n' + Log.getStackTraceString(tr)); 43 } 44 45 public static int d(String tag, String msg) { 46 return Log.println_native(Log.LOG_ID_RADIO, Log.DEBUG, tag, msg); 47 } 48 49 public static int d(String tag, String msg, Throwable tr) { 50 return Log.println_native(Log.LOG_ID_RADIO, Log.DEBUG, tag, 51 msg + '\n' + Log.getStackTraceString(tr)); 52 } 53 54 public static int i(String tag, String msg) { 55 return Log.println_native(Log.LOG_ID_RADIO, Log.INFO, tag, msg); 56 } 57 58 public static int i(String tag, String msg, Throwable tr) { 59 return Log.println_native(Log.LOG_ID_RADIO, Log.INFO, tag, 60 msg + '\n' + Log.getStackTraceString(tr)); 61 } 62 63 public static int w(String tag, String msg) { 64 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag, msg); 65 } 66 67 public static int w(String tag, String msg, Throwable tr) { 68 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag, 69 msg + '\n' + Log.getStackTraceString(tr)); 70 } 71 72 public static int w(String tag, Throwable tr) { 73 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag, Log.getStackTraceString(tr)); 74 } 75 76 public static int e(String tag, String msg) { 77 return Log.println_native(Log.LOG_ID_RADIO, Log.ERROR, tag, msg); 78 } 79 80 public static int e(String tag, String msg, Throwable tr) { 81 return Log.println_native(Log.LOG_ID_RADIO, Log.ERROR, tag, 82 msg + '\n' + Log.getStackTraceString(tr)); 83 } 84 85 public static int println(int priority, String tag, String msg) { 86 return Log.println_native(Log.LOG_ID_RADIO, priority, tag, msg); 87 } 88 89 public static boolean isLoggable(String tag, int level) { 90 return Log.isLoggable(tag, level); 91 } 92 93} 94 95