001 /*
002 * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.osgi.service.log;
017
018 import java.util.EventListener;
019
020 /**
021 * Subscribes to <code>LogEntry</code> objects from the <code>LogReaderService</code>.
022 *
023 * <p>
024 * A <code>LogListener</code> object may be registered with the Log Reader Service
025 * using the <code>LogReaderService.addLogListener</code> method. After the
026 * listener is registered, the <code>logged</code> method will be called for each
027 * <code>LogEntry</code> object created. The <code>LogListener</code> object may be
028 * unregistered by calling the <code>LogReaderService.removeLogListener</code>
029 * method.
030 *
031 * @ThreadSafe
032 * @version $Revision: 5654 $
033 * @see LogReaderService
034 * @see LogEntry
035 * @see LogReaderService#addLogListener(LogListener)
036 * @see LogReaderService#removeLogListener(LogListener)
037 */
038 public interface LogListener extends EventListener {
039 /**
040 * Listener method called for each LogEntry object created.
041 *
042 * <p>
043 * As with all event listeners, this method should return to its caller as
044 * soon as possible.
045 *
046 * @param entry A <code>LogEntry</code> object containing log information.
047 * @see LogEntry
048 */
049 public void logged(LogEntry entry);
050 }