com.squeakysand.osgi.framework
Class LoggingServiceListener

java.lang.Object
  extended by com.squeakysand.osgi.framework.LoggingServiceListener
All Implemented Interfaces:
EventListener, org.osgi.framework.ServiceListener

public class LoggingServiceListener
extends Object
implements org.osgi.framework.ServiceListener

ServiceListener implementation that will listen for events based on the supplied event filter and will log them using SLF4J.

Author:
Craig S. Dickson

Constructor Summary
LoggingServiceListener()
          Creates a LoggingServiceListener that logs with its own logger.
LoggingServiceListener(Logger logger)
          Creates a LoggingServiceListener that logs with the supplied Logger instance.
 
Method Summary
 void serviceChanged(org.osgi.framework.ServiceEvent event)
           
 void setEventFilter(Predicate<? super org.osgi.framework.ServiceEvent> eventFilter)
          Sets the filter to use to determine which ServiceEvents should be logged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingServiceListener

public LoggingServiceListener()
Creates a LoggingServiceListener that logs with its own logger.


LoggingServiceListener

public LoggingServiceListener(Logger logger)
Creates a LoggingServiceListener that logs with the supplied Logger instance.

Parameters:
logger - the Logger instance ot use.
Method Detail

setEventFilter

public void setEventFilter(Predicate<? super org.osgi.framework.ServiceEvent> eventFilter)
Sets the filter to use to determine which ServiceEvents should be logged.

Parameters:
eventFilter - the filter to use.

serviceChanged

public void serviceChanged(org.osgi.framework.ServiceEvent event)
Specified by:
serviceChanged in interface org.osgi.framework.ServiceListener


Copyright 2010-2012 Craig S. Dickson (http://craigsdickson.com)