• 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 import com.android.internal.os.RuntimeInit;
20 
21 import java.io.PrintWriter;
22 import java.io.StringWriter;
23 
24 /**
25  * @hide
26  */
27 public final class Slog {
28 
Slog()29     private Slog() {
30     }
31 
v(String tag, String msg)32     public static int v(String tag, String msg) {
33         return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag, msg);
34     }
35 
v(String tag, String msg, Throwable tr)36     public static int v(String tag, String msg, Throwable tr) {
37         return Log.println_native(Log.LOG_ID_SYSTEM, Log.VERBOSE, tag,
38                 msg + '\n' + Log.getStackTraceString(tr));
39     }
40 
d(String tag, String msg)41     public static int d(String tag, String msg) {
42         return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag, msg);
43     }
44 
d(String tag, String msg, Throwable tr)45     public static int d(String tag, String msg, Throwable tr) {
46         return Log.println_native(Log.LOG_ID_SYSTEM, Log.DEBUG, tag,
47                 msg + '\n' + Log.getStackTraceString(tr));
48     }
49 
i(String tag, String msg)50     public static int i(String tag, String msg) {
51         return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag, msg);
52     }
53 
i(String tag, String msg, Throwable tr)54     public static int i(String tag, String msg, Throwable tr) {
55         return Log.println_native(Log.LOG_ID_SYSTEM, Log.INFO, tag,
56                 msg + '\n' + Log.getStackTraceString(tr));
57     }
58 
w(String tag, String msg)59     public static int w(String tag, String msg) {
60         return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, msg);
61     }
62 
w(String tag, String msg, Throwable tr)63     public static int w(String tag, String msg, Throwable tr) {
64         return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag,
65                 msg + '\n' + Log.getStackTraceString(tr));
66     }
67 
w(String tag, Throwable tr)68     public static int w(String tag, Throwable tr) {
69         return Log.println_native(Log.LOG_ID_SYSTEM, Log.WARN, tag, Log.getStackTraceString(tr));
70     }
71 
e(String tag, String msg)72     public static int e(String tag, String msg) {
73         return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag, msg);
74     }
75 
e(String tag, String msg, Throwable tr)76     public static int e(String tag, String msg, Throwable tr) {
77         return Log.println_native(Log.LOG_ID_SYSTEM, Log.ERROR, tag,
78                 msg + '\n' + Log.getStackTraceString(tr));
79     }
80 
println(int priority, String tag, String msg)81     public static int println(int priority, String tag, String msg) {
82         return Log.println_native(Log.LOG_ID_SYSTEM, priority, tag, msg);
83     }
84 }
85 
86