100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato/* 200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * Copyright (C) 2006 The Android Open Source Project 300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * 400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * Licensed under the Apache License, Version 2.0 (the "License"); 500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * you may not use this file except in compliance with the License. 600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * You may obtain a copy of the License at 700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * 800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * http://www.apache.org/licenses/LICENSE-2.0 900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * 1000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * Unless required by applicable law or agreed to in writing, software 1100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * distributed under the License is distributed on an "AS IS" BASIS, 1200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * See the License for the specific language governing permissions and 1400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * limitations under the License. 1500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato */ 1600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 1700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onoratopackage android.util; 1800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 1900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato/** 2000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato * @hide 2100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato */ 2200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onoratopublic final class Slog { 2300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 2400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato private Slog() { 2500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 2600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 2700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int v(String tag, String msg) { 2800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg); 2900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 3000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 3100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int v(String tag, String msg, Throwable tr) { 3200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, 3300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato msg + '\n' + Log.getStackTraceString(tr)); 3400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 3500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 3600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int d(String tag, String msg) { 3700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, msg); 3800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 3900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 4000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int d(String tag, String msg, Throwable tr) { 4100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, 4200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato msg + '\n' + Log.getStackTraceString(tr)); 4300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 4400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 4500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int i(String tag, String msg) { 4600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, msg); 4700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 4800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 4900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int i(String tag, String msg, Throwable tr) { 5000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, 5100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato msg + '\n' + Log.getStackTraceString(tr)); 5200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 5300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 5400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int w(String tag, String msg) { 5500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, msg); 5600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 5700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 5800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int w(String tag, String msg, Throwable tr) { 5900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, 6000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato msg + '\n' + Log.getStackTraceString(tr)); 6100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 6200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 6300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int w(String tag, Throwable tr) { 6400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, Log.getStackTraceString(tr)); 6500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 6600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 6700bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int e(String tag, String msg) { 6800bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, msg); 6900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 7000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 7100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int e(String tag, String msg, Throwable tr) { 7200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, 7300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato msg + '\n' + Log.getStackTraceString(tr)); 7400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 7500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 768d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn /** 778d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * Like {@link Log#wtf(String, String)}, but will never cause the caller to crash, and 788d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * will always be handled asynchronously. Primarily for use by coding running within 798d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * the system process. 808d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn */ 81164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn public static int wtf(String tag, String msg) { 825232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true); 83164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn } 84164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn 858d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn /** 861e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn * Like {@link #wtf(String, String)}, but does not output anything to the log. 871e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn */ 881e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn public static void wtfQuiet(String tag, String msg) { 891e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true); 901e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn } 911e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn 921e01d16982e6b22ec4c0e2d6dc1e261eb6f92c8eDianne Hackborn /** 938d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * Like {@link Log#wtfStack(String, String)}, but will never cause the caller to crash, and 948d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * will always be handled asynchronously. Primarily for use by coding running within 958d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * the system process. 968d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn */ 97164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn public static int wtfStack(String tag, String msg) { 985232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true); 99164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn } 100164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn 1018d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn /** 1028d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * Like {@link Log#wtf(String, Throwable)}, but will never cause the caller to crash, 1038d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * and will always be handled asynchronously. Primarily for use by coding running within 1048d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * the system process. 1058d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn */ 106164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn public static int wtf(String tag, Throwable tr) { 1075232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true); 108164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn } 109164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn 1108d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn /** 1118d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * Like {@link Log#wtf(String, String, Throwable)}, but will never cause the caller to crash, 1128d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * and will always be handled asynchronously. Primarily for use by coding running within 1138d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn * the system process. 1148d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn */ 115164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn public static int wtf(String tag, String msg, Throwable tr) { 1165232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true); 117164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn } 118164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn 11900bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato public static int println(int priority, String tag, String msg) { 12000bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg); 12100bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato } 12200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato} 12300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato 124