All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.igormaznitsa.jscreed.log.JScreedLoggerImpl Maven / Gradle / Ivy

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with this
 * work for additional information regarding copyright ownership. The ASF
 * 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
 *
 * http://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 com.igormaznitsa.jscreed.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The Wrapper for Slf4j logger to be used by JScreed.
 *
 * @author Igor Maznitsa (http://www.igormaznitsa.com)
 */
public final class JScreedLoggerImpl implements JScreedLogger {

    /**
     * Inside link to the logger based on the name of the JScreedLogger interface.
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(JScreedLogger.class);

    /**
     * The Constructor.
     */
    public JScreedLoggerImpl() {
    }

    @Override
    public boolean isDebugAllowed() {
        return LOGGER.isDebugEnabled();
    }

    @Override
    public boolean isWarnAllowed() {
        return LOGGER.isWarnEnabled();
    }

    @Override
    public boolean isInfoAllowed() {
        return LOGGER.isInfoEnabled();
    }

    @Override
    public void logMessage(final int level, final String message) {
        switch (level) {
            case LOG_DEBUG: {
                LOGGER.debug(message);
            }
            break;
            case LOG_INFO: {
                LOGGER.info(message);
            }
            break;
            case LOG_WARN: {
                LOGGER.warn(message);
            }
            break;
            default: {
                LOGGER.error("JScreed Detected impossible situation #8817712 [" + level + ':' + message + ']');
            }
            break;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy