首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

打包 lo4j (转)-02

2012-10-26 
封装 lo4j (转)-02public void info(Object message) {if (logger.isInfoEnabled()) {forcedLog(logger, L

封装 lo4j (转)-02

public void info(Object message) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, message);}}public void info(Object message, Throwable t) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, message, t);}}public void info(String pattern, Object... arguments) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, format(pattern, arguments));}}public void info(String pattern, Throwable t, Object... arguments) {if (logger.isInfoEnabled()) {forcedLog(logger, Level.INFO, format(pattern, arguments), t);}}public void warn(Object message) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, message);}}public void warn(Object message, Throwable t) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, message, t);}}public void warn(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, format(pattern, arguments));}}public void warn(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.WARN)) {forcedLog(logger, Level.WARN, format(pattern, arguments), t);}}public void error(Object message) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, message);}}public void error(Object message, Throwable t) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, message, t);}}public void error(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, format(pattern, arguments));}}public void error(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.ERROR)) {forcedLog(logger, Level.ERROR, format(pattern, arguments), t);}}public void fatal(Object message) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, message);}}public void fatal(Object message, Throwable t) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, message, t);}}public void fatal(String pattern, Object... arguments) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, format(pattern, arguments));}}public void fatal(String pattern, Throwable t, Object... arguments) {if (logger.isEnabledFor(Level.FATAL)) {forcedLog(logger, Level.FATAL, format(pattern, arguments), t);}}public void assertLog(boolean assertion, String message) {if (!assertion) {forcedLog(logger, Level.ERROR, message);}}private static void forcedLog(Logger logger, Level level, Object message) {logger.callAppenders(new LoggingEvent(FQCN, logger, level, message, null));}private static void forcedLog(Logger logger, Level level, Object message, Throwable t) {logger.callAppenders(new LoggingEvent(FQCN, logger, level, message, t));}private static String format(String pattern, Object... arguments) {return MessageFormat.format(pattern, arguments);}}
?

热点排行