Class NettyClientLogger


  • public final class NettyClientLogger
    extends Object
    Logger facade similar to 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.

    • Method Detail

      • debug

        public void debug​(io.netty.channel.Channel channel,
                          Supplier<String> msgSupplier)
        Log a DEBUG level message including the channel information.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
      • debug

        public 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.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
        t - The throwable to log
      • warn

        public void warn​(io.netty.channel.Channel channel,
                         Supplier<String> msgSupplier)
        Log a WARN level message and including the channel information.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
      • error

        public 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.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
        t - The throwable to log
      • error

        public void error​(io.netty.channel.Channel channel,
                          Supplier<String> msgSupplier)
        Log a ERROR level message and including the channel information.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
      • warn

        public 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.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message
        t - The throwable to log
      • trace

        public void trace​(io.netty.channel.Channel channel,
                          Supplier<String> msgSupplier)
        Log a TRACE level message including the channel information.
        Parameters:
        channel - The channel for this message is being logged
        msgSupplier - Supplier for the log message