public class RedirectOutputHandler<LoggerClass,ChannelEquivalent> extends OutputHandler
| Modifier and Type | Field and Description |
|---|---|
LoggerClass |
logger |
Method |
loggingMethod |
addRandomColors, channelColors, channelSeparatorChar, channelStyles, info, leftMargin, minLineCountForTrackNameReminder, queuedTracks, tab, trackColor, trackStack, trackStyleEMPTY| Constructor and Description |
|---|
RedirectOutputHandler(LoggerClass logger,
Method loggingMethod)
Create a redirect handler, with a logging class, ignoring logging
levels.
|
RedirectOutputHandler(LoggerClass logger,
Method loggingMethod,
Map<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(StringBuilder b,
String channelStr,
Object channel)
Ensure that we don't print duplicate channels when adapting to another logging framework.
|
static RedirectOutputHandler<Logger,Level> |
fromJavaUtilLogging(Logger logger) |
void |
print(Object[] channels,
String line)
Print a string to an output without the trailing newline.
|
colorChannel, handle, setColorChannels, signalEndTrack, signalStartTrack, style, styleChannel, supportsAnsisignalShutdownpublic final LoggerClass logger
public final Method loggingMethod
public RedirectOutputHandler(LoggerClass logger, 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, Method loggingMethod, Map<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(Object[] channels, String line)
OutputHandlerprint in class OutputHandlerchannels - 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(StringBuilder b, String channelStr, Object channel)
formatChannel in class OutputHandlerb - The StringBuilder to append tochannelStr - The [possibly truncated and/or modified] string
to actually print to the StringBuilderchannel - The original channelpublic static RedirectOutputHandler<Logger,Level> fromJavaUtilLogging(Logger logger)