public class Logger
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
LOG_DEBUG |
static int |
LOG_ERROR |
static int |
LOG_INFO |
static int |
LOG_WARNING |
private org.osgi.framework.BundleContext |
m_context
Bundle context.
|
private boolean |
m_isLogClassPresent |
Constructor and Description |
---|
Logger(org.osgi.framework.BundleContext context)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
_log(int level,
java.lang.String message,
java.lang.Throwable exception)
Lookup the OSGi LogService and if available use it.
|
private java.io.PrintStream |
getStream(int level)
Return the standard print streams to use depending on log level.
|
void |
log(int level,
java.lang.String message)
Logs a message.
|
void |
log(int level,
java.lang.String message,
java.lang.Throwable exception)
Logs a message.
|
public static final int LOG_ERROR
public static final int LOG_WARNING
public static final int LOG_INFO
public static final int LOG_DEBUG
private final org.osgi.framework.BundleContext m_context
private boolean m_isLogClassPresent
public Logger(org.osgi.framework.BundleContext context)
context
- bundle contextpublic void log(int level, java.lang.String message)
level
- The severity of the message. Tmessage
- Human readable string describing the condition or
null
.LogService.log(int, String)
public void log(int level, java.lang.String message, java.lang.Throwable exception)
level
- The severity of the message. Tmessage
- Human readable string describing the condition or
null
.exception
- The exception that reflects the condition or
null
.LogService.log(int, String, Throwable)
private boolean _log(int level, java.lang.String message, java.lang.Throwable exception)
private java.io.PrintStream getStream(int level)
level
- log level