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    /**
868d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * Like {@link Log#wtfStack(String, String)}, but will never cause the caller to crash, and
878d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * will always be handled asynchronously.  Primarily for use by coding running within
888d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * the system process.
898d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     */
90164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    public static int wtfStack(String tag, String msg) {
915232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn        return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true);
92164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    }
93164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn
948d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn    /**
958d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * Like {@link Log#wtf(String, Throwable)}, but will never cause the caller to crash,
968d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * and will always be handled asynchronously.  Primarily for use by coding running within
978d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * the system process.
988d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     */
99164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    public static int wtf(String tag, Throwable tr) {
1005232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn        return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true);
101164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    }
102164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn
1038d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn    /**
1048d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * Like {@link Log#wtf(String, String, Throwable)}, but will never cause the caller to crash,
1058d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * and will always be handled asynchronously.  Primarily for use by coding running within
1068d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     * the system process.
1078d05172112436a81bed6e4a0810f8914509d8a4dDianne Hackborn     */
108164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    public static int wtf(String tag, String msg, Throwable tr) {
1095232271a41323594ae406be7476b6ca2f08af3d8Dianne Hackborn        return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true);
110164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn    }
111164371fb759bad6854570af0fca60d9a01e17235Dianne Hackborn
11200bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato    public static int println(int priority, String tag, String msg) {
11300bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato        return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
11400bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato    }
11500bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato}
11600bb93823d082c31d757bd7b75a8615afbd2c1a5Joe Onorato
117