| /* |
| * Copyright (C) 2009 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package com.android.mms; |
| |
| import android.util.Log; |
| |
| public class LogTag { |
| public static final String TAG = "Mms"; |
| |
| public static final String TRANSACTION = "Mms:transaction"; |
| public static final String APP = "Mms:app"; |
| |
| private static String prettyArray(String[] array) { |
| if (array.length == 0) { |
| return "[]"; |
| } |
| |
| StringBuilder sb = new StringBuilder("["); |
| int len = array.length-1; |
| for (int i = 0; i < len; i++) { |
| sb.append(array[i]); |
| sb.append(", "); |
| } |
| sb.append(array[len]); |
| sb.append("]"); |
| |
| return sb.toString(); |
| } |
| |
| private static String logFormat(String format, Object... args) { |
| for (int i = 0; i < args.length; i++) { |
| if (args[i] instanceof String[]) { |
| args[i] = prettyArray((String[])args[i]); |
| } |
| } |
| String s = String.format(format, args); |
| s = "[" + Thread.currentThread().getId() + "] " + s; |
| return s; |
| } |
| |
| public static void debug(String format, Object... args) { |
| Log.d(TAG, logFormat(format, args)); |
| } |
| |
| public static void warn(String format, Object... args) { |
| Log.w(TAG, logFormat(format, args)); |
| } |
| |
| public static void error(String format, Object... args) { |
| Log.e(TAG, logFormat(format, args)); |
| } |
| } |