com.igormaznitsa.jscreed.log.JScreedLoggerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jscreed-log4j Show documentation
Show all versions of jscreed-log4j Show documentation
It's an adapter allows to the JScreed framework to work with Log4J 1.2
The newest version!
/**
* 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.apache.log4j.Logger;
import org.apache.log4j.Priority;
/**
* The Wrapper for LOG4J logger to be used by JScreed.
*
* @author Igor Maznitsa (http://www.igormaznitsa.com)
*/
public final class JScreedLoggerImpl implements JScreedLogger {
/**
* Inside logger linked to the JScreedLogger interface.
*/
private static final Logger LOGGER = Logger.getLogger(JScreedLogger.class);
/**
* The Constructor.
*/
public JScreedLoggerImpl() {
}
@Override
public boolean isDebugAllowed() {
return LOGGER.isDebugEnabled();
}
@Override
public boolean isWarnAllowed() {
return LOGGER.isEnabledFor(Priority.WARN);
}
@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.fatal("JScreed Detected impossible situation #1234211 [" + level + ':' + message + ']');
}
break;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy