83
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2004, 2008 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
105
|
7 *
|
83
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 *******************************************************************************/
|
105
|
11 // Port to the D programming language:
|
|
12 // Frank Benoit <benoit@tionex.de>
|
83
|
13 module org.eclipse.osgi.framework.log.FrameworkLog;
|
|
14
|
|
15 import java.lang.all;
|
105
|
16
|
|
17 import org.eclipse.osgi.framework.log.FrameworkLogEntry; // packageimport
|
|
18
|
83
|
19 import java.io.File;
|
105
|
20 import java.io.IOException;
|
83
|
21 import java.io.Writer;
|
|
22
|
|
23 import org.osgi.framework.FrameworkEvent;
|
|
24
|
|
25 /**
|
|
26 * The FramworkLog interface. A FrameworkLog implementation is provided by the
|
|
27 * FrameworkAdaptor and used by the Framework to log any error messages and
|
105
|
28 * FrameworkEvents of type ERROR. The FrameworkLog may persist the log messages
|
83
|
29 * to the filesystem or allow other ways of accessing the log information.
|
|
30 * @since 3.1
|
|
31 * @noimplement This interface is not intended to be implemented by clients.
|
|
32 */
|
|
33 public interface FrameworkLog {
|
|
34 /**
|
105
|
35 * A service lookup constant (value "performance") indicating an
|
|
36 * implementation of the logging service that logs performance events.
|
|
37 * Create a filter with this property set to <code>"true"</code> in order to
|
83
|
38 * obtain a performance log.
|
105
|
39 *
|
83
|
40 * @since 3.1
|
|
41 */
|
|
42 public static final String SERVICE_PERFORMANCE = "performance"; //$NON-NLS-1$
|
|
43
|
|
44 /**
|
|
45 * Logs the information from a FrameworkEvent to the FrameworkLog.
|
|
46 * @param frameworkEvent The FrameworkEvent to log.
|
|
47 */
|
|
48 public void log(FrameworkEvent frameworkEvent);
|
|
49
|
|
50 /**
|
|
51 * Logs the FrameworkLogEntry to the FrameworkLog
|
|
52 * @param logEntry The entry to log.
|
|
53 */
|
|
54 public void log(FrameworkLogEntry logEntry);
|
|
55
|
|
56 /**
|
|
57 * Sets the current Writer used to log messages to the specified
|
|
58 * newWriter. If append is set to true then the content
|
105
|
59 * of the current Writer will be appended to the new Writer
|
83
|
60 * if possible.
|
105
|
61 * @param newWriter The Writer to use for logging messages.
|
83
|
62 * @param append Indicates whether the content of the current Writer
|
105
|
63 * used for logging messages should be appended to the end of the new
|
83
|
64 * Writer.
|
|
65 */
|
|
66 public void setWriter(Writer newWriter, bool append);
|
|
67
|
105
|
68 /**
|
83
|
69 * Sets the current File used to log messages to a FileWriter
|
105
|
70 * using the specified File. If append is set to true then the
|
|
71 * content of the current Writer will be appended to the
|
83
|
72 * new File if possible.
|
|
73 * @param newFile The File to create a new FileWriter which will be
|
|
74 * used for logging messages.
|
|
75 * @param append Indicates whether the content of the current Writer
|
105
|
76 * used for logging messages should be appended to the end of the new
|
83
|
77 * File.
|
|
78 * @throws IOException if any problem occurs while constructing a
|
105
|
79 * FileWriter from the newFile. If this exception is thrown the
|
|
80 * FrameworkLog will not be effected and will continue to use the
|
83
|
81 * current Writer to log messages.
|
|
82 */
|
|
83 public void setFile(File newFile, bool append) ;
|
|
84
|
|
85 /**
|
|
86 * Returns the log File if it is set, otherwise null is returned.
|
|
87 * @return the log File if it is set, otherwise null is returned.
|
|
88 */
|
|
89 public File getFile();
|
|
90
|
|
91 /**
|
|
92 * Sets the console log option. If this is set then all logs will be
|
|
93 * logged to System.out as well as the current Writer.
|
|
94 * @param consoleLog indicates whether to log to System.out
|
|
95 */
|
|
96 public void setConsoleLog(bool consoleLog);
|
|
97
|
|
98 /**
|
|
99 * Closes the FrameworkLog. After the FrameworkLog is closed messages may
|
|
100 * no longer be logged to it.
|
|
101 */
|
|
102 public void close();
|
|
103 }
|