2 * Copyright (C) 2012 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.telephony;
19 import android.util.Log;
22 * A class to log strings to the RADIO LOG.
26 public final class Rlog {
31 public static int v(String tag, String msg) {
32 return Log.println_native(Log.LOG_ID_RADIO, Log.VERBOSE, tag, msg);
35 public static int v(String tag, String msg, Throwable tr) {
36 return Log.println_native(Log.LOG_ID_RADIO, Log.VERBOSE, tag,
37 msg + '\n' + Log.getStackTraceString(tr));
40 public static int d(String tag, String msg) {
41 return Log.println_native(Log.LOG_ID_RADIO, Log.DEBUG, tag, msg);
44 public static int d(String tag, String msg, Throwable tr) {
45 return Log.println_native(Log.LOG_ID_RADIO, Log.DEBUG, tag,
46 msg + '\n' + Log.getStackTraceString(tr));
49 public static int i(String tag, String msg) {
50 return Log.println_native(Log.LOG_ID_RADIO, Log.INFO, tag, msg);
53 public static int i(String tag, String msg, Throwable tr) {
54 return Log.println_native(Log.LOG_ID_RADIO, Log.INFO, tag,
55 msg + '\n' + Log.getStackTraceString(tr));
58 public static int w(String tag, String msg) {
59 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag, msg);
62 public static int w(String tag, String msg, Throwable tr) {
63 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag,
64 msg + '\n' + Log.getStackTraceString(tr));
67 public static int w(String tag, Throwable tr) {
68 return Log.println_native(Log.LOG_ID_RADIO, Log.WARN, tag, Log.getStackTraceString(tr));
71 public static int e(String tag, String msg) {
72 return Log.println_native(Log.LOG_ID_RADIO, Log.ERROR, tag, msg);
75 public static int e(String tag, String msg, Throwable tr) {
76 return Log.println_native(Log.LOG_ID_RADIO, Log.ERROR, tag,
77 msg + '\n' + Log.getStackTraceString(tr));
80 public static int println(int priority, String tag, String msg) {
81 return Log.println_native(Log.LOG_ID_RADIO, priority, tag, msg);
84 public static boolean isLoggable(String tag, int level) {
85 return Log.isLoggable(tag, level);
89 * Redact personally identifiable information for production users.
90 * If log tag is loggable in verbose mode, return the original string, otherwise return XXX.
92 public static String pii(String tag, Object pii) {
93 return (isLoggable(tag, Log.VERBOSE) ? String.valueOf(pii) : "XXX");