blob: 12e6c8d9ce44e9f1b6dc837af424e2c520f74e39 [file] [log] [blame]
Richard S. Hallf5931c12006-12-15 21:56:11 +00001/*
2 * $Header: /cvshome/build/org.osgi.service.log/src/org/osgi/service/log/LogEntry.java,v 1.9 2006/06/16 16:31:49 hargrave Exp $
3 *
4 * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18package org.osgi.service.log;
19
20import org.osgi.framework.Bundle;
21import org.osgi.framework.ServiceReference;
22
23/**
24 * Provides methods to access the information contained in an individual Log
25 * Service log entry.
26 *
27 * <p>
28 * A <code>LogEntry</code> object may be acquired from the
29 * <code>LogReaderService.getLog</code> method or by registering a
30 * <code>LogListener</code> object.
31 *
32 * @version $Revision: 1.9 $
33 * @see LogReaderService#getLog
34 * @see LogListener
35 */
36public interface LogEntry {
37 /**
38 * Returns the bundle that created this <code>LogEntry</code> object.
39 *
40 * @return The bundle that created this <code>LogEntry</code> object;
41 * <code>null</code> if no bundle is associated with this
42 * <code>LogEntry</code> object.
43 */
44 public Bundle getBundle();
45
46 /**
47 * Returns the <code>ServiceReference</code> object for the service associated
48 * with this <code>LogEntry</code> object.
49 *
50 * @return <code>ServiceReference</code> object for the service associated
51 * with this <code>LogEntry</code> object; <code>null</code> if no
52 * <code>ServiceReference</code> object was provided.
53 */
54 public ServiceReference getServiceReference();
55
56 /**
57 * Returns the severity level of this <code>LogEntry</code> object.
58 *
59 * <p>
60 * This is one of the severity levels defined by the <code>LogService</code>
61 * interface.
62 *
63 * @return Severity level of this <code>LogEntry</code> object.
64 *
65 * @see LogService#LOG_ERROR
66 * @see LogService#LOG_WARNING
67 * @see LogService#LOG_INFO
68 * @see LogService#LOG_DEBUG
69 */
70 public int getLevel();
71
72 /**
73 * Returns the human readable message associated with this <code>LogEntry</code>
74 * object.
75 *
76 * @return <code>String</code> containing the message associated with this
77 * <code>LogEntry</code> object.
78 */
79 public String getMessage();
80
81 /**
82 * Returns the exception object associated with this <code>LogEntry</code>
83 * object.
84 *
85 * <p>
86 * In some implementations, the returned exception may not be the original
87 * exception. To avoid references to a bundle defined exception class, thus
88 * preventing an uninstalled bundle from being garbage collected, the Log
89 * Service may return an exception object of an implementation defined
90 * Throwable subclass. The returned object will attempt to provide as much
91 * information as possible from the original exception object such as the
92 * message and stack trace.
93 *
94 * @return <code>Throwable</code> object of the exception associated with this
95 * <code>LogEntry</code>;<code>null</code> if no exception is
96 * associated with this <code>LogEntry</code> object.
97 */
98 public Throwable getException();
99
100 /**
101 * Returns the value of <code>currentTimeMillis()</code> at the time this
102 * <code>LogEntry</code> object was created.
103 *
104 * @return The system time in milliseconds when this <code>LogEntry</code>
105 * object was created.
106 * @see "System.currentTimeMillis()"
107 */
108 public long getTime();
109}