• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package android.util;
18 
19 /**
20  * @hide
21  */
22 public final class Slog {
23 
Slog()24     private Slog() {
25     }
26 
v(String tag, String msg)27     public static int v(String tag, String msg) {
28         return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
29     }
30 
v(String tag, String msg, Throwable tr)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 
d(String tag, String msg)36     public static int d(String tag, String msg) {
37         return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, msg);
38     }
39 
d(String tag, String msg, Throwable tr)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 
i(String tag, String msg)45     public static int i(String tag, String msg) {
46         return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, msg);
47     }
48 
i(String tag, String msg, Throwable tr)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 
w(String tag, String msg)54     public static int w(String tag, String msg) {
55         return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, msg);
56     }
57 
w(String tag, String msg, Throwable tr)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 
w(String tag, Throwable tr)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 
e(String tag, String msg)67     public static int e(String tag, String msg) {
68         return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, msg);
69     }
70 
e(String tag, String msg, Throwable tr)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 
76     /**
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      */
wtf(String tag, String msg)81     public static int wtf(String tag, String msg) {
82         return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, false, true);
83     }
84 
85     /**
86      * Like {@link Log#wtfStack(String, String)}, but will never cause the caller to crash, and
87      * will always be handled asynchronously.  Primarily for use by coding running within
88      * the system process.
89      */
wtfStack(String tag, String msg)90     public static int wtfStack(String tag, String msg) {
91         return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, null, true, true);
92     }
93 
94     /**
95      * Like {@link Log#wtf(String, Throwable)}, but will never cause the caller to crash,
96      * and will always be handled asynchronously.  Primarily for use by coding running within
97      * the system process.
98      */
wtf(String tag, Throwable tr)99     public static int wtf(String tag, Throwable tr) {
100         return Log.wtf(Log.LOG_ID_SYSTEM, tag, tr.getMessage(), tr, false, true);
101     }
102 
103     /**
104      * Like {@link Log#wtf(String, String, Throwable)}, but will never cause the caller to crash,
105      * and will always be handled asynchronously.  Primarily for use by coding running within
106      * the system process.
107      */
wtf(String tag, String msg, Throwable tr)108     public static int wtf(String tag, String msg, Throwable tr) {
109         return Log.wtf(Log.LOG_ID_SYSTEM, tag, msg, tr, false, true);
110     }
111 
println(int priority, String tag, String msg)112     public static int println(int priority, String tag, String msg) {
113         return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
114     }
115 }
116 
117