OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.base; | 5 package org.chromium.base; |
6 | 6 |
7 import android.text.TextUtils; | 7 import org.chromium.base.annotations.RemovableInRelease; |
8 | |
9 import org.chromium.base.annotations.NoSideEffects; | |
10 | 8 |
11 import java.util.Locale; | 9 import java.util.Locale; |
12 | 10 |
13 /** | 11 /** |
14 * Utility class for Logging. | 12 * Utility class for Logging. |
15 * | 13 * |
16 * <p> | 14 * <p> |
17 * Defines logging access points for each feature. They format and forward the l
ogs to | 15 * Defines logging access points for each feature. They format and forward the l
ogs to |
18 * {@link android.util.Log}, allowing to standardize the output, to make it easy
to identify | 16 * {@link android.util.Log}, allowing to standardize the output, to make it easy
to identify |
19 * the origin of logs, and enable or disable logging in different parts of the c
ode. | 17 * the origin of logs, and enable or disable logging in different parts of the c
ode. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 53 } |
56 | 54 |
57 /** | 55 /** |
58 * Returns a formatted log message, using the supplied format and arguments. | 56 * Returns a formatted log message, using the supplied format and arguments. |
59 * The message will be prepended with the filename and line number of the ca
ll. | 57 * The message will be prepended with the filename and line number of the ca
ll. |
60 */ | 58 */ |
61 private static String formatLogWithStack(String messageTemplate, Object... p
arams) { | 59 private static String formatLogWithStack(String messageTemplate, Object... p
arams) { |
62 return "[" + getCallOrigin() + "] " + formatLog(messageTemplate, params)
; | 60 return "[" + getCallOrigin() + "] " + formatLog(messageTemplate, params)
; |
63 } | 61 } |
64 | 62 |
65 /** | |
66 * Returns a full tag for the provided group tag. Full tags longer than 23 c
haracters | |
67 * will cause a runtime exception. | |
68 * | |
69 * @param groupTag {@code null} and empty string are allowed. | |
70 * | |
71 * @see android.util.Log#isLoggable(String, int) | |
72 * @throws IllegalArgumentException if the tag is too long. | |
73 * @deprecated Directly use a string (e.g. "cr.Tag") in your class. See http
://crbug.com/485772 | |
74 */ | |
75 @Deprecated | |
76 public static String makeTag(String groupTag) { | |
77 if (TextUtils.isEmpty(groupTag)) return "cr"; | |
78 String tag = "cr." + groupTag; | |
79 if (tag.length() > 23) { | |
80 throw new IllegalArgumentException( | |
81 "The full tag (" + tag + ") is longer than 23 characters."); | |
82 } | |
83 return tag; | |
84 } | |
85 | |
86 /** Convenience function, forwards to {@link android.util.Log#isLoggable(Str
ing, int)}. */ | 63 /** Convenience function, forwards to {@link android.util.Log#isLoggable(Str
ing, int)}. */ |
87 public static boolean isLoggable(String tag, int level) { | 64 public static boolean isLoggable(String tag, int level) { |
88 return android.util.Log.isLoggable(tag, level); | 65 return android.util.Log.isLoggable(tag, level); |
89 } | 66 } |
90 | 67 |
91 /** | 68 /** |
92 * Sends a {@link android.util.Log#VERBOSE} log message. | 69 * Sends a {@link android.util.Log#VERBOSE} log message. |
93 * | 70 * |
94 * For optimization purposes, only the fixed parameters versions are visible
. If you need more | 71 * For optimization purposes, only the fixed parameters versions are visible
. If you need more |
95 * than 7 parameters, consider building your log message using a function an
notated with | 72 * than 7 parameters, consider building your log message using a function an
notated with |
96 * {@link NoSideEffects}. | 73 * {@link RemovableInRelease}. |
97 * | 74 * |
98 * @param tag Used to identify the source of a log message. | 75 * @param tag Used to identify the source of a log message. |
99 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 76 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
100 * string. | 77 * string. |
101 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 78 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
102 * one is a {@link Throwable}, its trace will be printed. | 79 * one is a {@link Throwable}, its trace will be printed. |
103 */ | 80 */ |
104 private static void verbose(String tag, String messageTemplate, Object... ar
gs) { | 81 private static void verbose(String tag, String messageTemplate, Object... ar
gs) { |
105 if (android.util.Log.isLoggable(tag, android.util.Log.VERBOSE)) { | 82 if (Log.isLoggable(tag, Log.VERBOSE)) { |
106 String message = formatLogWithStack(messageTemplate, args); | 83 String message = formatLogWithStack(messageTemplate, args); |
107 Throwable tr = getThrowableToLog(args); | 84 Throwable tr = getThrowableToLog(args); |
108 if (tr != null) { | 85 if (tr != null) { |
109 android.util.Log.v(tag, message, tr); | 86 android.util.Log.v(tag, message, tr); |
110 } else { | 87 } else { |
111 android.util.Log.v(tag, message); | 88 android.util.Log.v(tag, message); |
112 } | 89 } |
113 } | 90 } |
114 } | 91 } |
115 | 92 |
116 /** Sends a {@link android.util.Log#VERBOSE} log message. 0 arg version. */ | 93 /** Sends a {@link android.util.Log#VERBOSE} log message. 0 args version. */ |
| 94 @RemovableInRelease |
| 95 @VisibleForTesting |
117 public static void v(String tag, String message) { | 96 public static void v(String tag, String message) { |
118 verbose(tag, message); | 97 verbose(tag, message); |
119 } | 98 } |
120 | 99 |
121 /** Sends a {@link android.util.Log#VERBOSE} log message. 1 arg version. */ | 100 /** Sends a {@link android.util.Log#VERBOSE} log message. 1 arg version. */ |
| 101 @RemovableInRelease |
| 102 @VisibleForTesting |
122 public static void v(String tag, String messageTemplate, Object arg1) { | 103 public static void v(String tag, String messageTemplate, Object arg1) { |
123 verbose(tag, messageTemplate, arg1); | 104 verbose(tag, messageTemplate, arg1); |
124 } | 105 } |
125 | 106 |
126 /** Sends a {@link android.util.Log#VERBOSE} log message. 2 args version */ | 107 /** Sends a {@link android.util.Log#VERBOSE} log message. 2 args version */ |
| 108 @RemovableInRelease |
| 109 @VisibleForTesting |
127 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2) { | 110 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2) { |
128 verbose(tag, messageTemplate, arg1, arg2); | 111 verbose(tag, messageTemplate, arg1, arg2); |
129 } | 112 } |
130 | 113 |
131 /** Sends a {@link android.util.Log#VERBOSE} log message. 3 args version */ | 114 /** Sends a {@link android.util.Log#VERBOSE} log message. 3 args version */ |
| 115 @RemovableInRelease |
| 116 @VisibleForTesting |
132 public static void v( | 117 public static void v( |
133 String tag, String messageTemplate, Object arg1, Object arg2, Object
arg3) { | 118 String tag, String messageTemplate, Object arg1, Object arg2, Object
arg3) { |
134 verbose(tag, messageTemplate, arg1, arg2, arg3); | 119 verbose(tag, messageTemplate, arg1, arg2, arg3); |
135 } | 120 } |
136 | 121 |
137 /** Sends a {@link android.util.Log#VERBOSE} log message. 4 args version */ | 122 /** Sends a {@link android.util.Log#VERBOSE} log message. 4 args version */ |
| 123 @RemovableInRelease |
| 124 @VisibleForTesting |
138 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 125 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
139 Object arg4) { | 126 Object arg4) { |
140 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4); | 127 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4); |
141 } | 128 } |
142 | 129 |
143 /** Sends a {@link android.util.Log#VERBOSE} log message. 5 args version */ | 130 /** Sends a {@link android.util.Log#VERBOSE} log message. 5 args version */ |
| 131 @RemovableInRelease |
| 132 @VisibleForTesting |
144 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 133 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
145 Object arg4, Object arg5) { | 134 Object arg4, Object arg5) { |
146 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5); | 135 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5); |
147 } | 136 } |
148 | 137 |
149 /** Sends a {@link android.util.Log#VERBOSE} log message. 6 args version */ | 138 /** Sends a {@link android.util.Log#VERBOSE} log message. 6 args version */ |
| 139 @RemovableInRelease |
| 140 @VisibleForTesting |
150 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 141 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
151 Object arg4, Object arg5, Object arg6) { | 142 Object arg4, Object arg5, Object arg6) { |
152 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6); | 143 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6); |
153 } | 144 } |
154 | 145 |
155 /** Sends a {@link android.util.Log#VERBOSE} log message. 7 args version */ | 146 /** Sends a {@link android.util.Log#VERBOSE} log message. 7 args version */ |
| 147 @RemovableInRelease |
| 148 @VisibleForTesting |
156 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 149 public static void v(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
157 Object arg4, Object arg5, Object arg6, Object arg7) { | 150 Object arg4, Object arg5, Object arg6, Object arg7) { |
158 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 151 verbose(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
159 } | 152 } |
160 | 153 |
161 /** | 154 /** |
162 * Sends a {@link android.util.Log#DEBUG} log message. | 155 * Sends a {@link android.util.Log#DEBUG} log message. |
163 * | 156 * |
164 * For optimization purposes, only the fixed parameters versions are visible
. If you need more | 157 * For optimization purposes, only the fixed parameters versions are visible
. If you need more |
165 * than 7 parameters, consider building your log message using a function an
notated with | 158 * than 7 parameters, consider building your log message using a function an
notated with |
166 * {@link NoSideEffects}. | 159 * {@link RemovableInRelease}. |
167 * | 160 * |
168 * @param tag Used to identify the source of a log message. | 161 * @param tag Used to identify the source of a log message. |
169 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 162 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
170 * string. | 163 * string. |
171 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 164 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
172 * one is a {@link Throwable}, its trace will be printed. | 165 * one is a {@link Throwable}, its trace will be printed. |
173 */ | 166 */ |
174 private static void debug(String tag, String messageTemplate, Object... args
) { | 167 private static void debug(String tag, String messageTemplate, Object... args
) { |
175 if (android.util.Log.isLoggable(tag, android.util.Log.VERBOSE)) { | 168 if (isLoggable(tag, Log.DEBUG)) { |
176 String message = formatLogWithStack(messageTemplate, args); | 169 String message = formatLogWithStack(messageTemplate, args); |
177 Throwable tr = getThrowableToLog(args); | 170 Throwable tr = getThrowableToLog(args); |
178 if (tr != null) { | 171 if (tr != null) { |
179 android.util.Log.d(tag, message, tr); | 172 android.util.Log.d(tag, message, tr); |
180 } else { | 173 } else { |
181 android.util.Log.d(tag, message); | 174 android.util.Log.d(tag, message); |
182 } | 175 } |
183 } | 176 } |
184 } | 177 } |
185 | 178 |
186 /** Sends a {@link android.util.Log#DEBUG} log message. 0 arg version. */ | 179 /** Sends a {@link android.util.Log#DEBUG} log message. 0 args version. */ |
| 180 @RemovableInRelease |
| 181 @VisibleForTesting |
187 public static void d(String tag, String message) { | 182 public static void d(String tag, String message) { |
188 debug(tag, message); | 183 debug(tag, message); |
189 } | 184 } |
190 | 185 |
191 /** Sends a {@link android.util.Log#DEBUG} log message. 1 arg version. */ | 186 /** Sends a {@link android.util.Log#DEBUG} log message. 1 arg version. */ |
| 187 @RemovableInRelease |
| 188 @VisibleForTesting |
192 public static void d(String tag, String messageTemplate, Object arg1) { | 189 public static void d(String tag, String messageTemplate, Object arg1) { |
193 debug(tag, messageTemplate, arg1); | 190 debug(tag, messageTemplate, arg1); |
194 } | 191 } |
195 /** Sends a {@link android.util.Log#DEBUG} log message. 2 args version */ | 192 /** Sends a {@link android.util.Log#DEBUG} log message. 2 args version */ |
| 193 @RemovableInRelease |
| 194 @VisibleForTesting |
196 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2) { | 195 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2) { |
197 debug(tag, messageTemplate, arg1, arg2); | 196 debug(tag, messageTemplate, arg1, arg2); |
198 } | 197 } |
199 /** Sends a {@link android.util.Log#DEBUG} log message. 3 args version */ | 198 /** Sends a {@link android.util.Log#DEBUG} log message. 3 args version */ |
| 199 @RemovableInRelease |
| 200 @VisibleForTesting |
200 public static void d( | 201 public static void d( |
201 String tag, String messageTemplate, Object arg1, Object arg2, Object
arg3) { | 202 String tag, String messageTemplate, Object arg1, Object arg2, Object
arg3) { |
202 debug(tag, messageTemplate, arg1, arg2, arg3); | 203 debug(tag, messageTemplate, arg1, arg2, arg3); |
203 } | 204 } |
204 | 205 |
205 /** Sends a {@link android.util.Log#DEBUG} log message. 4 args version */ | 206 /** Sends a {@link android.util.Log#DEBUG} log message. 4 args version */ |
| 207 @RemovableInRelease |
| 208 @VisibleForTesting |
206 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 209 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
207 Object arg4) { | 210 Object arg4) { |
208 debug(tag, messageTemplate, arg1, arg2, arg3, arg4); | 211 debug(tag, messageTemplate, arg1, arg2, arg3, arg4); |
209 } | 212 } |
210 | 213 |
211 /** Sends a {@link android.util.Log#DEBUG} log message. 5 args version */ | 214 /** Sends a {@link android.util.Log#DEBUG} log message. 5 args version */ |
| 215 @RemovableInRelease |
| 216 @VisibleForTesting |
212 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 217 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
213 Object arg4, Object arg5) { | 218 Object arg4, Object arg5) { |
214 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5); | 219 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5); |
215 } | 220 } |
216 | 221 |
217 /** Sends a {@link android.util.Log#DEBUG} log message. 6 args version */ | 222 /** Sends a {@link android.util.Log#DEBUG} log message. 6 args version */ |
| 223 @RemovableInRelease |
| 224 @VisibleForTesting |
218 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 225 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
219 Object arg4, Object arg5, Object arg6) { | 226 Object arg4, Object arg5, Object arg6) { |
220 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6); | 227 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6); |
221 } | 228 } |
222 | 229 |
223 /** Sends a {@link android.util.Log#DEBUG} log message. 7 args version */ | 230 /** Sends a {@link android.util.Log#DEBUG} log message. 7 args version */ |
| 231 @RemovableInRelease |
| 232 @VisibleForTesting |
224 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, | 233 public static void d(String tag, String messageTemplate, Object arg1, Object
arg2, Object arg3, |
225 Object arg4, Object arg5, Object arg6, Object arg7) { | 234 Object arg4, Object arg5, Object arg6, Object arg7) { |
226 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7); | 235 debug(tag, messageTemplate, arg1, arg2, arg3, arg4, arg5, arg6, arg7); |
227 } | 236 } |
228 | 237 |
229 /** | 238 /** |
230 * Sends an {@link android.util.Log#INFO} log message. | 239 * Sends an {@link android.util.Log#INFO} log message. |
231 * | 240 * |
232 * @param tag Used to identify the source of a log message. | 241 * @param tag Used to identify the source of a log message. |
233 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 242 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
234 * string. | 243 * string. |
235 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 244 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
236 * one is a {@link Throwable}, its trace will be printed. | 245 * one is a {@link Throwable}, its trace will be printed. |
237 */ | 246 */ |
| 247 @VisibleForTesting |
238 public static void i(String tag, String messageTemplate, Object... args) { | 248 public static void i(String tag, String messageTemplate, Object... args) { |
239 if (android.util.Log.isLoggable(tag, android.util.Log.INFO)) { | 249 if (Log.isLoggable(tag, Log.INFO)) { |
240 String message = formatLog(messageTemplate, args); | 250 String message = formatLog(messageTemplate, args); |
241 Throwable tr = getThrowableToLog(args); | 251 Throwable tr = getThrowableToLog(args); |
242 if (tr != null) { | 252 if (tr != null) { |
243 android.util.Log.i(tag, message, tr); | 253 android.util.Log.i(tag, message, tr); |
244 } else { | 254 } else { |
245 android.util.Log.i(tag, message); | 255 android.util.Log.i(tag, message); |
246 } | 256 } |
247 } | 257 } |
248 } | 258 } |
249 | 259 |
250 /** | 260 /** |
251 * Sends a {@link android.util.Log#WARN} log message. | 261 * Sends a {@link android.util.Log#WARN} log message. |
252 * | 262 * |
253 * @param tag Used to identify the source of a log message. | 263 * @param tag Used to identify the source of a log message. |
254 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 264 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
255 * string. | 265 * string. |
256 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 266 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
257 * one is a {@link Throwable}, its trace will be printed. | 267 * one is a {@link Throwable}, its trace will be printed. |
258 */ | 268 */ |
| 269 @VisibleForTesting |
259 public static void w(String tag, String messageTemplate, Object... args) { | 270 public static void w(String tag, String messageTemplate, Object... args) { |
260 if (android.util.Log.isLoggable(tag, android.util.Log.WARN)) { | 271 if (Log.isLoggable(tag, Log.WARN)) { |
261 String message = formatLog(messageTemplate, args); | 272 String message = formatLog(messageTemplate, args); |
262 Throwable tr = getThrowableToLog(args); | 273 Throwable tr = getThrowableToLog(args); |
263 if (tr != null) { | 274 if (tr != null) { |
264 android.util.Log.w(tag, message, tr); | 275 android.util.Log.w(tag, message, tr); |
265 } else { | 276 } else { |
266 android.util.Log.w(tag, message); | 277 android.util.Log.w(tag, message); |
267 } | 278 } |
268 } | 279 } |
269 } | 280 } |
270 | 281 |
271 /** | 282 /** |
272 * Sends an {@link android.util.Log#ERROR} log message. | 283 * Sends an {@link android.util.Log#ERROR} log message. |
273 * | 284 * |
274 * @param tag Used to identify the source of a log message. | 285 * @param tag Used to identify the source of a log message. |
275 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 286 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
276 * string. | 287 * string. |
277 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 288 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
278 * one is a {@link Throwable}, its trace will be printed. | 289 * one is a {@link Throwable}, its trace will be printed. |
279 */ | 290 */ |
| 291 @VisibleForTesting |
280 public static void e(String tag, String messageTemplate, Object... args) { | 292 public static void e(String tag, String messageTemplate, Object... args) { |
281 if (android.util.Log.isLoggable(tag, android.util.Log.ERROR)) { | 293 if (Log.isLoggable(tag, Log.ERROR)) { |
282 String message = formatLog(messageTemplate, args); | 294 String message = formatLog(messageTemplate, args); |
283 Throwable tr = getThrowableToLog(args); | 295 Throwable tr = getThrowableToLog(args); |
284 if (tr != null) { | 296 if (tr != null) { |
285 android.util.Log.e(tag, message, tr); | 297 android.util.Log.e(tag, message, tr); |
286 } else { | 298 } else { |
287 android.util.Log.e(tag, message); | 299 android.util.Log.e(tag, message); |
288 } | 300 } |
289 } | 301 } |
290 } | 302 } |
291 | 303 |
292 /** | 304 /** |
293 * What a Terrible Failure: Used for conditions that should never happen, an
d logged at | 305 * What a Terrible Failure: Used for conditions that should never happen, an
d logged at |
294 * the {@link android.util.Log#ASSERT} level. Depending on the configuration
, it might | 306 * the {@link android.util.Log#ASSERT} level. Depending on the configuration
, it might |
295 * terminate the process. | 307 * terminate the process. |
296 * | 308 * |
297 * @see android.util.Log#wtf(String, String, Throwable) | 309 * @see android.util.Log#wtf(String, String, Throwable) |
298 * | 310 * |
299 * @param tag Used to identify the source of a log message. | 311 * @param tag Used to identify the source of a log message. |
300 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format | 312 * @param messageTemplate The message you would like logged. It is to be spe
cified as a format |
301 * string. | 313 * string. |
302 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last | 314 * @param args Arguments referenced by the format specifiers in the format s
tring. If the last |
303 * one is a {@link Throwable}, its trace will be printed. | 315 * one is a {@link Throwable}, its trace will be printed. |
304 */ | 316 */ |
| 317 @VisibleForTesting |
305 public static void wtf(String tag, String messageTemplate, Object... args) { | 318 public static void wtf(String tag, String messageTemplate, Object... args) { |
306 if (android.util.Log.isLoggable(tag, android.util.Log.ERROR)) { | 319 if (Log.isLoggable(tag, Log.ASSERT)) { |
307 String message = formatLog(messageTemplate, args); | 320 String message = formatLog(messageTemplate, args); |
308 Throwable tr = getThrowableToLog(args); | 321 Throwable tr = getThrowableToLog(args); |
309 if (tr != null) { | 322 if (tr != null) { |
310 android.util.Log.wtf(tag, message, tr); | 323 android.util.Log.wtf(tag, message, tr); |
311 } else { | 324 } else { |
312 android.util.Log.wtf(tag, message); | 325 android.util.Log.wtf(tag, message); |
313 } | 326 } |
314 } | 327 } |
315 } | 328 } |
316 | 329 |
(...skipping 23 matching lines...) Expand all Loading... |
340 for (callerStackIndex = 0; callerStackIndex < st.length; callerStackInde
x++) { | 353 for (callerStackIndex = 0; callerStackIndex < st.length; callerStackInde
x++) { |
341 if (st[callerStackIndex].getClassName().equals(logClassName)) { | 354 if (st[callerStackIndex].getClassName().equals(logClassName)) { |
342 callerStackIndex += 4; | 355 callerStackIndex += 4; |
343 break; | 356 break; |
344 } | 357 } |
345 } | 358 } |
346 | 359 |
347 return st[callerStackIndex].getFileName() + ":" + st[callerStackIndex].g
etLineNumber(); | 360 return st[callerStackIndex].getFileName() + ":" + st[callerStackIndex].g
etLineNumber(); |
348 } | 361 } |
349 } | 362 } |
OLD | NEW |