Debian Codegraph @

common/src/main/java/com/android/utils/ILogger.java

raw
1 /*
2 * Copyright (C) 2012 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 com.android.utils;
18
19 import com.android.annotations.NonNull;
20 import com.android.annotations.Nullable;
21
22 import java.util.Formatter;
23
24 /**
25 * <p>
26 * Interface used to display warnings/errors while parsing the SDK content.
27 * </p>
28 * There are a few default implementations available:
29 * <ul>
30 * <li> {@link NullLogger} is an implementation that does <em>nothing</em> with the log.
31 * Useful for limited cases where you need to call a class that requires a non-null logging
32 * yet the calling code does not have any mean of reporting logs itself. It can be
33 * acceptable for use as a temporary implementation but most of the time that means the caller
34 * code needs to be reworked to take a logger object from its own caller.
35 * </li>
36 * <li> {@link StdLogger} is an implementation that dumps the log to {@link System#out} or
37 * {@link System#err}. This is useful for unit tests or code that does not have any GUI.
38 * GUI based apps based should not use it and should provide a better way to report to the user.
39 * </li>
40 * </ul>
41 */
42 public interface ILogger {
43
44 /**
45 * Prints an error message.
46 *
47 * @param t is an optional {@link Throwable} or {@link Exception}. If non-null, its
48 * message will be printed out.
49 * @param msgFormat is an optional error format. If non-null, it will be printed
50 * using a {@link Formatter} with the provided arguments.
51 * @param args provides the arguments for errorFormat.
52 */
53 void error(@Nullable Throwable t, @Nullable String msgFormat, Object... args);
54
55 /**
56 * Prints a warning message.
57 *
58 * @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
59 * @param args provides the arguments for warningFormat.
60 */
61 void warning(@NonNull String msgFormat, Object... args);
62
63 /**
64 * Prints an information message.
65 *
66 * @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
67 * @param args provides the arguments for msgFormat.
68 */
69 void info(@NonNull String msgFormat, Object... args);
70
71 /**
72 * Prints a verbose message.
73 *
74 * @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
75 * @param args provides the arguments for msgFormat.
76 */
77 void verbose(@NonNull String msgFormat, Object... args);
78
79 }