blob: 7df5d10b9a5103153a71890d99ffdf443df70475 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.utils;
import com.android.annotations.NonNull;
import java.util.Formatter;
/**
* Interface used to display warnings/errors while parsing the SDK content.
* <p/>
* There are a few default implementations available:
* <ul>
* <li> {@link NullLogger} is an implementation that does <em>nothing</em> with the log.
* Useful for limited cases where you need to call a class that requires a non-null logging
* yet the calling code does not have any mean of reporting logs itself. It can be
* acceptable for use as a temporary implementation but most of the time that means the caller
* code needs to be reworked to take a logger object from its own caller.
* </li>
* <li> {@link StdLogger} is an implementation that dumps the log to {@link System#out} or
* {@link System#err}. This is useful for unit tests or code that does not have any GUI.
* GUI based apps based should not use it and should provide a better way to report to the user.
* </li>
* </ul>
*/
public interface ILogger {
/**
* Prints an error message.
*
* @param t is an optional {@link Throwable} or {@link Exception}. If non-null, its
* message will be printed out.
* @param msgFormat is an optional error format. If non-null, it will be printed
* using a {@link Formatter} with the provided arguments.
* @param args provides the arguments for errorFormat.
*/
void error(Throwable t, String msgFormat, Object... args);
/**
* Prints a warning message.
*
* @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
* @param args provides the arguments for warningFormat.
*/
void warning(@NonNull String msgFormat, Object... args);
/**
* Prints an information message.
*
* @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
* @param args provides the arguments for msgFormat.
*/
void info(@NonNull String msgFormat, Object... args);
/**
* Prints a verbose message.
*
* @param msgFormat is a string format to be used with a {@link Formatter}. Cannot be null.
* @param args provides the arguments for msgFormat.
*/
void verbose(@NonNull String msgFormat, Object... args);
}
|