public final class NettyClientLogger extends Object
Logger
, that also includes channel information in the message
when provided. When the logger has at least DEBUG level enabled, the logger uses Channel#toString()
to provide the
complete information about the channel. If only less verbose levels are available, then only the channel's ID is logged.
Having the channel information associated with the log message whenever available makes correlating messages that are all logged within the context of that channel possible; this is impossible to do otherwise because there is a 1:M mapping from event loops to channels.
NOTE: The absence of overrides that don't take a Channel
parameter is deliberate. This is done to lessen the
chances that a {code Channel} is omitted from the log by accident.
Modifier and Type | Method and Description |
---|---|
void |
debug(io.netty.channel.Channel channel,
Supplier<String> msgSupplier)
Log a DEBUG level message including the channel information.
|
void |
debug(io.netty.channel.Channel channel,
Supplier<String> msgSupplier,
Throwable t)
Log a DEBUG level message with the given exception and including the channel information.
|
void |
error(io.netty.channel.Channel channel,
Supplier<String> msgSupplier)
Log a ERROR level message and including the channel information.
|
void |
error(io.netty.channel.Channel channel,
Supplier<String> msgSupplier,
Throwable t)
Log a ERROR level message with the given exception and including the channel information.
|
static NettyClientLogger |
getLogger(Class<?> clzz) |
void |
trace(io.netty.channel.Channel channel,
Supplier<String> msgSupplier)
Log a TRACE level message including the channel information.
|
void |
warn(io.netty.channel.Channel channel,
Supplier<String> msgSupplier)
Log a WARN level message and including the channel information.
|
void |
warn(io.netty.channel.Channel channel,
Supplier<String> msgSupplier,
Throwable t)
Log a WARN level message with the given exception and including the channel information.
|
public static NettyClientLogger getLogger(Class<?> clzz)
public void debug(io.netty.channel.Channel channel, Supplier<String> msgSupplier)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messagepublic void debug(io.netty.channel.Channel channel, Supplier<String> msgSupplier, Throwable t)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messaget
- The throwable to logpublic void warn(io.netty.channel.Channel channel, Supplier<String> msgSupplier)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messagepublic void error(io.netty.channel.Channel channel, Supplier<String> msgSupplier, Throwable t)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messaget
- The throwable to logpublic void error(io.netty.channel.Channel channel, Supplier<String> msgSupplier)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messagepublic void warn(io.netty.channel.Channel channel, Supplier<String> msgSupplier, Throwable t)
channel
- The channel for this message is being loggedmsgSupplier
- Supplier for the log messaget
- The throwable to logCopyright © 2022. All rights reserved.