Home / Class/ Http2FrameLogger Class — netty Architecture

Http2FrameLogger Class — netty Architecture

Architecture documentation for the Http2FrameLogger class in Http2FrameLogger.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b05a86d6_042a_ba9f_e399_5cb7b15de65a["Http2FrameLogger"]
  08b5c844_8c59_2ea5_e516_fb069a95c798["Http2FrameLogger.java"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|defined in| 08b5c844_8c59_2ea5_e516_fb069a95c798
  adc90ed8_195c_23d6_a815_baa388c8a885["Http2FrameLogger()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| adc90ed8_195c_23d6_a815_baa388c8a885
  d7cd0d0c_dcbf_5dd1_3612_4c2aeaad5c67["InternalLogLevel()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| d7cd0d0c_dcbf_5dd1_3612_4c2aeaad5c67
  a20063d9_42e3_4fe4_db8b_782d12725438["isEnabled()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| a20063d9_42e3_4fe4_db8b_782d12725438
  53362b3e_c9c8_35a5_2752_310923b6b40e["logData()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 53362b3e_c9c8_35a5_2752_310923b6b40e
  f6f21011_0353_1ea1_f14c_717f8b58352c["logHeaders()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| f6f21011_0353_1ea1_f14c_717f8b58352c
  0b059dc3_9d77_1d1f_d01f_92d33e7ab74b["logPriority()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 0b059dc3_9d77_1d1f_d01f_92d33e7ab74b
  a9d70d9c_752f_f4d4_3c93_b95d368e4352["logRstStream()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| a9d70d9c_752f_f4d4_3c93_b95d368e4352
  490f17c5_4802_948b_68da_dfe0598847a7["logSettingsAck()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 490f17c5_4802_948b_68da_dfe0598847a7
  f1b1bfde_8e29_3516_53d0_0e1bd53d6846["logSettings()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| f1b1bfde_8e29_3516_53d0_0e1bd53d6846
  2532b176_23f5_c5f0_6713_051941eae126["logPing()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 2532b176_23f5_c5f0_6713_051941eae126
  69a23f30_8c7a_7042_f0a0_c5e2b5fb376f["logPingAck()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 69a23f30_8c7a_7042_f0a0_c5e2b5fb376f
  b6995ca0_b481_a1ed_7b1a_8de2e887d071["logPushPromise()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| b6995ca0_b481_a1ed_7b1a_8de2e887d071
  1b023b31_2afa_8918_a3e8_4043ce0a5462["logGoAway()"]
  b05a86d6_042a_ba9f_e399_5cb7b15de65a -->|method| 1b023b31_2afa_8918_a3e8_4043ce0a5462

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameLogger.java lines 32–174

public class Http2FrameLogger extends ChannelHandlerAdapter {

    public enum Direction {
        INBOUND,
        OUTBOUND
    }

    private static final int BUFFER_LENGTH_THRESHOLD = 64;
    private final InternalLogger logger;
    private final InternalLogLevel level;

    public Http2FrameLogger(LogLevel level) {
        this(checkAndConvertLevel(level), InternalLoggerFactory.getInstance(Http2FrameLogger.class));
    }

    public Http2FrameLogger(LogLevel level, String name) {
        this(checkAndConvertLevel(level), InternalLoggerFactory.getInstance(checkNotNull(name, "name")));
    }

    public Http2FrameLogger(LogLevel level, Class<?> clazz) {
        this(checkAndConvertLevel(level), InternalLoggerFactory.getInstance(checkNotNull(clazz, "clazz")));
    }

    private Http2FrameLogger(InternalLogLevel level, InternalLogger logger) {
        this.level = level;
        this.logger = logger;
    }

    private static InternalLogLevel checkAndConvertLevel(LogLevel level) {
        return checkNotNull(level, "level").toInternalLevel();
    }

    public boolean isEnabled() {
        return logger.isEnabled(level);
    }

    public void logData(Direction direction, ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
            boolean endStream) {
        if (isEnabled()) {
            logger.log(level, "{} {} DATA: streamId={} padding={} endStream={} length={} bytes={}", ctx.channel(),
                    direction.name(), streamId, padding, endStream, data.readableBytes(), toString(data));
        }
    }

    public void logHeaders(Direction direction, ChannelHandlerContext ctx, int streamId, Http2Headers headers,
            int padding, boolean endStream) {
        if (isEnabled()) {
            logger.log(level, "{} {} HEADERS: streamId={} headers={} padding={} endStream={}", ctx.channel(),
                    direction.name(), streamId, headers, padding, endStream);
        }
    }

    public void logHeaders(Direction direction, ChannelHandlerContext ctx, int streamId, Http2Headers headers,
            int streamDependency, short weight, boolean exclusive, int padding, boolean endStream) {
        if (isEnabled()) {
            logger.log(level, "{} {} HEADERS: streamId={} headers={} streamDependency={} weight={} exclusive={} " +
                    "padding={} endStream={}", ctx.channel(),
                    direction.name(), streamId, headers, streamDependency, weight, exclusive, padding, endStream);
        }
    }

    public void logPriority(Direction direction, ChannelHandlerContext ctx, int streamId, int streamDependency,
            short weight, boolean exclusive) {
        if (isEnabled()) {
            logger.log(level, "{} {} PRIORITY: streamId={} streamDependency={} weight={} exclusive={}", ctx.channel(),
                    direction.name(), streamId, streamDependency, weight, exclusive);
        }
    }

    public void logRstStream(Direction direction, ChannelHandlerContext ctx, int streamId, long errorCode) {
        if (isEnabled()) {
            logger.log(level, "{} {} RST_STREAM: streamId={} errorCode={}", ctx.channel(),
                    direction.name(), streamId, errorCode);
        }
    }

    public void logSettingsAck(Direction direction, ChannelHandlerContext ctx) {
        logger.log(level, "{} {} SETTINGS: ack=true", ctx.channel(), direction.name());
    }

    public void logSettings(Direction direction, ChannelHandlerContext ctx, Http2Settings settings) {

Frequently Asked Questions

What is the Http2FrameLogger class?
Http2FrameLogger is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameLogger.java.
Where is Http2FrameLogger defined?
Http2FrameLogger is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameLogger.java at line 32.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free