public class RedirectOutputHandler<LoggerClass,ChannelEquivalent> extends OutputHandler
Modifier and Type | Field and Description |
---|---|
LoggerClass |
logger |
java.lang.reflect.Method |
loggingMethod |
addRandomColors, channelColors, channelSeparatorChar, channelStyles, info, leftMargin, minLineCountForTrackNameReminder, queuedTracks, tab, trackColor, trackStack, trackStyle
EMPTY
Constructor and Description |
---|
RedirectOutputHandler(LoggerClass logger,
java.lang.reflect.Method loggingMethod)
Create a redirect handler, with a logging class, ignoring logging
levels.
|
RedirectOutputHandler(LoggerClass logger,
java.lang.reflect.Method loggingMethod,
java.util.Map<java.lang.Object,ChannelEquivalent> channelMapping,
ChannelEquivalent defaultChannel)
Create a redirect handler, with a logging class, redirecting both the logging
message, and the channel that it came from
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
formatChannel(java.lang.StringBuilder b,
java.lang.String channelStr,
java.lang.Object channel)
Ensure that we don't print duplicate channels when adapting to another logging framework.
|
static RedirectOutputHandler<java.util.logging.Logger,java.util.logging.Level> |
fromJavaUtilLogging(java.util.logging.Logger logger) |
void |
print(java.lang.Object[] channels,
java.lang.String line)
Print a string to an output without the trailing newline.
|
colorChannel, handle, setColorChannels, signalEndTrack, signalStartTrack, style, styleChannel, supportsAnsi
signalShutdown
public final LoggerClass logger
public final java.lang.reflect.Method loggingMethod
public RedirectOutputHandler(LoggerClass logger, java.lang.reflect.Method loggingMethod)
logger
- The class to use for logging. For example, java.util.logging.LoggerloggingMethod
- A method which takes a *single* String argument
and logs that string using the |logger| class.public RedirectOutputHandler(LoggerClass logger, java.lang.reflect.Method loggingMethod, java.util.Map<java.lang.Object,ChannelEquivalent> channelMapping, ChannelEquivalent defaultChannel)
logger
- The class to use for logging. For example,
java.util.logging.LoggerloggingMethod
- A method which takes a *single* String argument
and logs that string using the |logger| class.channelMapping
- The mapping from Redwood channels, to the native Channel equivalent.public void print(java.lang.Object[] channels, java.lang.String line)
OutputHandler
print
in class OutputHandler
channels
- The channels this message was printed on; in most cases
an implementing handler should not have to do anything with
this. The channels should not be printed here.
The channels may be null.line
- The string to be printed.protected boolean formatChannel(java.lang.StringBuilder b, java.lang.String channelStr, java.lang.Object channel)
formatChannel
in class OutputHandler
b
- The StringBuilder to append tochannelStr
- The [possibly truncated and/or modified] string
to actually print to the StringBuilderchannel
- The original channelpublic static RedirectOutputHandler<java.util.logging.Logger,java.util.logging.Level> fromJavaUtilLogging(java.util.logging.Logger logger)