blob: 58a27037e03f8069631e816dc0fbe7c9e9e82962 [file] [log] [blame]
Joe Onorato00bb9382010-02-26 18:07:01 -08001/*
2 * Copyright (C) 2006 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.util;
18
Joe Onorato00bb9382010-02-26 18:07:01 -080019/**
20 * @hide
21 */
22public final class Slog {
23
24 private Slog() {
25 }
26
27 public static int v(String tag, String msg) {
28 return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
29 }
30
31 public static int v(String tag, String msg, Throwable tr) {
32 return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag,
33 msg + '\n' + Log.getStackTraceString(tr));
34 }
35
36 public static int d(String tag, String msg) {
37 return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, msg);
38 }
39
40 public static int d(String tag, String msg, Throwable tr) {
41 return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag,
42 msg + '\n' + Log.getStackTraceString(tr));
43 }
44
45 public static int i(String tag, String msg) {
46 return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, msg);
47 }
48
49 public static int i(String tag, String msg, Throwable tr) {
50 return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag,
51 msg + '\n' + Log.getStackTraceString(tr));
52 }
53
54 public static int w(String tag, String msg) {
55 return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, msg);
56 }
57
58 public static int w(String tag, String msg, Throwable tr) {
59 return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag,
60 msg + '\n' + Log.getStackTraceString(tr));
61 }
62
63 public static int w(String tag, Throwable tr) {
64 return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, Log.getStackTraceString(tr));
65 }
66
67 public static int e(String tag, String msg) {
68 return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, msg);
69 }
70
71 public static int e(String tag, String msg, Throwable tr) {
72 return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag,
73 msg + '\n' + Log.getStackTraceString(tr));
74 }
75
Dianne Hackborn8d051722014-10-01 14:59:58 -070076 /**
77 * Like {@link Log#wtf(String, String)}, but will never cause the caller to crash, and
78 * will always be handled asynchronously. Primarily for use by coding running within
79 * the system process.
80 */
Dianne Hackborn164371f2013-10-01 19:10:13 -070081 public static int wtf(String tag, String msg) {
Dianne Hackborn52322712014-08-26 22:47:26 -070082 return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true);
Dianne Hackborn164371f2013-10-01 19:10:13 -070083 }
84
Dianne Hackborn8d051722014-10-01 14:59:58 -070085 /**
Dianne Hackborn1e01d162014-12-04 17:46:42 -080086 * Like {@link #wtf(String, String)}, but does not output anything to the log.
87 */
88 public static void wtfQuiet(String tag, String msg) {
89 Log.wtfQuiet(Log.LOG_ID_SYSTEM, tag, msg, true);
90 }
91
92 /**
Dianne Hackborn8d051722014-10-01 14:59:58 -070093 * Like {@link Log#wtfStack(String, String)}, but will never cause the caller to crash, and
94 * will always be handled asynchronously. Primarily for use by coding running within
95 * the system process.
96 */
Dianne Hackborn164371f2013-10-01 19:10:13 -070097 public static int wtfStack(String tag, String msg) {
Dianne Hackborn52322712014-08-26 22:47:26 -070098 return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true);
Dianne Hackborn164371f2013-10-01 19:10:13 -070099 }
100
Dianne Hackborn8d051722014-10-01 14:59:58 -0700101 /**
102 * Like {@link Log#wtf(String, Throwable)}, but will never cause the caller to crash,
103 * and will always be handled asynchronously. Primarily for use by coding running within
104 * the system process.
105 */
Dianne Hackborn164371f2013-10-01 19:10:13 -0700106 public static int wtf(String tag, Throwable tr) {
Dianne Hackborn52322712014-08-26 22:47:26 -0700107 return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true);
Dianne Hackborn164371f2013-10-01 19:10:13 -0700108 }
109
Dianne Hackborn8d051722014-10-01 14:59:58 -0700110 /**
111 * Like {@link Log#wtf(String, String, Throwable)}, but will never cause the caller to crash,
112 * and will always be handled asynchronously. Primarily for use by coding running within
113 * the system process.
114 */
Dianne Hackborn164371f2013-10-01 19:10:13 -0700115 public static int wtf(String tag, String msg, Throwable tr) {
Dianne Hackborn52322712014-08-26 22:47:26 -0700116 return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true);
Dianne Hackborn164371f2013-10-01 19:10:13 -0700117 }
118
Joe Onorato00bb9382010-02-26 18:07:01 -0800119 public static int println(int priority, String tag, String msg) {
120 return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
121 }
122}
123