Constructor and Description |
---|
Logger(LogSink sink,
Name source)
Constructs a new logger.
|
Modifier and Type | Method and Description |
---|---|
void |
config(String message)
Logs the specified message at the
CONFIG log level. |
<T extends Throwable> |
config(T throwable)
Logs the specified exception at the
CONFIG log level. |
void |
debug(String message)
Logs the specified message at the
DEBUG log level. |
<T extends Throwable> |
debug(T throwable)
Logs the specified exception at the
DEBUG log level. |
void |
error(String message)
Logs the specified message at the
ERROR log level. |
<T extends Throwable> |
error(T throwable)
Logs the specified exception at the
ERROR log level. |
LogTimer |
getTimer()
Returns a new timer to measure elapsed time.
|
LogTimer |
getTimer(String event)
Returns a new timer to measure elapsed time for a specified event.
|
void |
info(String message)
Logs the specified message at the
INFO log level. |
<T extends Throwable> |
info(T throwable)
Logs the specified exception at the
INFO log level. |
boolean |
isLoggable(LogLevel level)
Returns
true if the entry may be logged, given the source of this logger and
the specified log level. |
boolean |
isLoggable(Name source,
LogLevel level)
Returns
true if the entry may be logged, given the specified source name and log
level. |
void |
log(LogEntry entry)
Logs an entry.
|
<T extends Throwable> |
logException(LogLevel level,
T throwable)
Logs the specified exception.
|
void |
logMessage(LogLevel level,
String message)
Logs the message at the specified log level.
|
void |
trace(String message)
Logs the specified message at the
TRACE log level. |
<T extends Throwable> |
trace(T throwable)
Logs the specified exception at the
TRACE log level. |
void |
warning(String message)
Logs the specified message at the
WARNING log level. |
<T extends Throwable> |
warning(T throwable)
Logs the specified exception at the
WARNING log level. |
public Logger(LogSink sink, Name source)
null
, then a
NullLogSink
will be used.sink
- the sink to write log entries to.source
- the base source to write all log entries with.public void logMessage(LogLevel level, String message)
level
- the log level to set in the log entry.message
- the message to be logged.public <T extends Throwable> T logException(LogLevel level, T throwable)
T
- type of logged throwablelevel
- the log level to set in the log entry.throwable
- the exception to be logged.public void error(String message)
ERROR
log level.message
- the message to be logged.public <T extends Throwable> T error(T throwable)
ERROR
log level.T
- type of logged throwablethrowable
- the exception to be logged.public void warning(String message)
WARNING
log level.message
- the message to be logged.public <T extends Throwable> T warning(T throwable)
WARNING
log level.T
- type of logged throwablethrowable
- the exception to be logged.public void info(String message)
INFO
log level.message
- the message to be logged.public <T extends Throwable> T info(T throwable)
INFO
log level.T
- type of logged throwablethrowable
- the exception to be logged.public void config(String message)
CONFIG
log level.message
- the message to be logged.public <T extends Throwable> T config(T throwable)
CONFIG
log level.T
- type of logged throwablethrowable
- the exception to be logged.public void debug(String message)
DEBUG
log level.message
- the message to be logged.public <T extends Throwable> T debug(T throwable)
DEBUG
log level.T
- type of logged throwablethrowable
- the exception to be logged.public void trace(String message)
TRACE
log level.message
- the message to be logged.public <T extends Throwable> T trace(T throwable)
TRACE
log level.T
- type of logged throwablethrowable
- the exception to be logged.public LogTimer getTimer()
STAT
log level.public LogTimer getTimer(String event)
STAT
log level.event
- the event that is being timed.public void log(LogEntry entry)
entry
- the entry to be logged.public boolean isLoggable(Name source, LogLevel level)
true
if the entry may be logged, given the specified source name and log
level.source
- the source name that is intended to be logged.level
- the log level of the entry to be logged.true
if the entry may be logged.public boolean isLoggable(LogLevel level)
true
if the entry may be logged, given the source of this logger and
the specified log level.level
- the log level of the entry to be logged.true
if the entry may be logged.Copyright © 2014 ForgeRock AS. All rights reserved.