1 /* 2 * Copyright (C) 2008 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.sdklib; 18 19 import java.util.Formatter; 20 21 /** 22 * Interface used to display warnings/errors while parsing the SDK content. 23 */ 24 public interface ISdkLog { 25 26 /** 27 * Prints a warning message on stdout. 28 * <p/> 29 * The message will be tagged with "Warning" on the output so the caller does not 30 * need to put such a prefix in the format string. 31 * <p/> 32 * Implementations should only display warnings in verbose mode. 33 * 34 * @param warningFormat is an optional error format. If non-null, it will be printed 35 * using a {@link Formatter} with the provided arguments. 36 * @param args provides the arguments for warningFormat. 37 */ 38 void warning(String warningFormat, Object... args); 39 40 /** 41 * Prints an error message on stderr. 42 * <p/> 43 * The message will be tagged with "Error" on the output so the caller does not 44 * need to put such a prefix in the format string. 45 * <p/> 46 * Implementation should always display errors, independent of verbose mode. 47 * 48 * @param t is an optional {@link Throwable} or {@link Exception}. If non-null, it's 49 * message will be printed out. 50 * @param errorFormat is an optional error format. If non-null, it will be printed 51 * using a {@link Formatter} with the provided arguments. 52 * @param args provides the arguments for errorFormat. 53 */ 54 void error(Throwable t, String errorFormat, Object... args); 55 56 /** 57 * Prints a message as-is on stdout. 58 * <p/> 59 * Implementation should always display errors, independent of verbose mode. 60 * No prefix is used, the message is printed as-is after formatting. 61 * 62 * @param msgFormat is an optional error format. If non-null, it will be printed 63 * using a {@link Formatter} with the provided arguments. 64 * @param args provides the arguments for msgFormat. 65 */ 66 void printf(String msgFormat, Object... args); 67 } 68