1 /******************************************************************************* 2 * Copyright (c) 2011 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.equinox.internal.p2.director.app; 15 16 import org.eclipse.core.runtime.IStatus; 17 18 /** 19 * Manages all outputs of the director application: logs to a file as well as the standard streams 20 * <p> 21 * This indirection is needed in order to manage the outputs when the director is called from ant, where 22 * the standard streams are handled differently. 23 */ 24 public interface ILog { 25 /** 26 * Send status to the standard log 27 * 28 * @param status 29 */ log(IStatus status)30 void log(IStatus status); 31 32 /** 33 * 34 * @param message 35 * @deprecated Use {@link ILog#printOut()} or {@link ILog#printErr()} 36 */ 37 @Deprecated log(String message)38 default void log(String message) { 39 printOut(message); 40 } 41 42 /** 43 * Notify that logging is completed & cleanup resources 44 */ close()45 void close(); 46 47 /** 48 * Print status on stdout or stderr. 49 * 50 * By default calls {@link #log} 51 * 52 * @param status 53 */ printOut(String line)54 default void printOut(String line) { 55 System.out.println(line); 56 } 57 58 /** 59 * Send line to stdout 60 * 61 * By default does nothing 62 * 63 * @param message line 64 */ printErr(String line)65 default void printErr(String line) { 66 System.err.println(line); 67 } 68 } 69