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