comparison org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/log/FrameworkLog.d @ 83:0628aaa2996c

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