Home / File/ LocationAwareSlf4JLogger.java — netty Source File

LocationAwareSlf4JLogger.java — netty Source File

Architecture documentation for LocationAwareSlf4JLogger.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2017 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.util.internal.logging;

import org.slf4j.spi.LocationAwareLogger;

import static org.slf4j.spi.LocationAwareLogger.*;

/**
 * <a href="https://www.slf4j.org/">SLF4J</a> logger which is location aware and so will log the correct origin of the
 * logging event by filter out the wrapper itself.
 */
final class LocationAwareSlf4JLogger extends AbstractInternalLogger {

    // IMPORTANT: All our log methods first check if the log level is enabled before call the wrapped
    // LocationAwareLogger.log(...) method. This is done to reduce GC creation that is caused by varargs.

    static final String FQCN = LocationAwareSlf4JLogger.class.getName();
    private static final long serialVersionUID = -8292030083201538180L;

    private final transient LocationAwareLogger logger;

    LocationAwareSlf4JLogger(LocationAwareLogger logger) {
        super(logger.getName());
        this.logger = logger;
    }

    private void log(final int level, final String message) {
        logger.log(null, FQCN, level, message, null, null);
    }

    private void log(final int level, final String message, Throwable cause) {
        logger.log(null, FQCN, level, message, null, cause);
    }

    private void log(final int level, final org.slf4j.helpers.FormattingTuple tuple) {
        logger.log(null, FQCN, level, tuple.getMessage(), null, tuple.getThrowable());
    }

    @Override
    public boolean isTraceEnabled() {
        return logger.isTraceEnabled();
    }

    @Override
    public void trace(String msg) {
        if (isTraceEnabled()) {
// ... (193 more lines)

Domain

Subdomains

Frequently Asked Questions

What does LocationAwareSlf4JLogger.java do?
LocationAwareSlf4JLogger.java is a source file in the netty codebase, written in java. It belongs to the CommonUtil domain, Logging subdomain.
Where is LocationAwareSlf4JLogger.java in the architecture?
LocationAwareSlf4JLogger.java is located at common/src/main/java/io/netty/util/internal/logging/LocationAwareSlf4JLogger.java (domain: CommonUtil, subdomain: Logging, directory: common/src/main/java/io/netty/util/internal/logging).

Analyze Your Own Codebase

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

Try Supermodel Free