Home / Class/ RegexLogMatcher Class — netty Architecture

RegexLogMatcher Class — netty Architecture

Architecture documentation for the RegexLogMatcher class in LoggingHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e02d82f6_2956_3175_aa87_638b15652161["RegexLogMatcher"]
  55992997_622b_e15a_b1c6_c22953788a4b["LoggingHandlerTest.java"]
  e02d82f6_2956_3175_aa87_638b15652161 -->|defined in| 55992997_622b_e15a_b1c6_c22953788a4b
  fed55159_8c51_7e31_be70_d41e8f1e239b["RegexLogMatcher()"]
  e02d82f6_2956_3175_aa87_638b15652161 -->|method| fed55159_8c51_7e31_be70_d41e8f1e239b
  ba4c0274_0c17_5732_9ccc_2105f885e3f6["matches()"]
  e02d82f6_2956_3175_aa87_638b15652161 -->|method| ba4c0274_0c17_5732_9ccc_2105f885e3f6

Relationship Graph

Source Code

handler/src/test/java/io/netty/handler/logging/LoggingHandlerTest.java lines 292–318

    private static final class RegexLogMatcher implements ArgumentMatcher<ILoggingEvent> {

        private final String expected;
        private final boolean shouldContainNewline;
        private String actualMsg;

        RegexLogMatcher(String expected) {
            this(expected, false);
        }

        RegexLogMatcher(String expected, boolean shouldContainNewline) {
            this.expected = expected;
            this.shouldContainNewline = shouldContainNewline;
        }

        @Override
        @SuppressWarnings("DynamicRegexReplaceableByCompiledPattern")
        public boolean matches(ILoggingEvent actual) {
            // Match only the first line to skip the validation of hex-dump format.
            actualMsg = actual.getMessage().split("(?s)[\\r\\n]+")[0];
            if (actualMsg.matches(expected)) {
                // The presence of a newline implies a hex-dump was logged
                return actual.getMessage().contains(NEWLINE) == shouldContainNewline;
            }
            return false;
        }
    }

Frequently Asked Questions

What is the RegexLogMatcher class?
RegexLogMatcher is a class in the netty codebase, defined in handler/src/test/java/io/netty/handler/logging/LoggingHandlerTest.java.
Where is RegexLogMatcher defined?
RegexLogMatcher is defined in handler/src/test/java/io/netty/handler/logging/LoggingHandlerTest.java at line 292.

Analyze Your Own Codebase

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

Try Supermodel Free