@Override public void log(int level, String message) { switch (level) { case LogChute.TRACE_ID: logger.trace(message); break; case LogChute.DEBUG_ID: logger.debug(message); break; case LogChute.INFO_ID: logger.info(message); break; case LogChute.WARN_ID: logger.warn(message); break; case LogChute.ERROR_ID: logger.error(message); break; default: logger.error("Unknown log level requested ({}).", level); logger.error("Message: {}", message); } }
@Override public void log(int level, String message, Throwable t) { switch (level) { case LogChute.TRACE_ID: logger.trace(message, t); break; case LogChute.DEBUG_ID: logger.debug(message, t); break; case LogChute.INFO_ID: logger.info(message, t); break; case LogChute.WARN_ID: logger.warn(message, t); break; case LogChute.ERROR_ID: logger.error(message, t); break; default: logger.error("Unknown log level requested ({}).", level); logger.error("Message: " + message, t); } }
@Override public boolean isLevelEnabled(int level) { switch (level) { case LogChute.TRACE_ID: return logger.isTraceEnabled(); case LogChute.DEBUG_ID: return logger.isTraceEnabled(); case LogChute.INFO_ID: return logger.isTraceEnabled(); case LogChute.WARN_ID: return logger.isTraceEnabled(); case LogChute.ERROR_ID: return logger.isTraceEnabled(); default: return false; } }
@Override public boolean isLevelEnabled(int arg0) { switch (arg0) { case LogChute.DEBUG_ID: return log.isDebugEnabled(); case LogChute.TRACE_ID: return log.isTraceEnabled(); case LogChute.INFO_ID: return log.isInfoEnabled(); case LogChute.WARN_ID: return log.isWarnEnabled(); case LogChute.ERROR_ID: return log.isErrorEnabled(); } return true; }
@Override public void log(int arg0, String arg1) { switch (arg0) { case LogChute.DEBUG_ID: log.debug(arg1); break; case LogChute.TRACE_ID: log.trace(arg1); break; case LogChute.INFO_ID: log.info(arg1); break; case LogChute.WARN_ID: log.warn(arg1); break; case LogChute.ERROR_ID: log.error(arg1); break; default: log.fatal(arg1); } }
@Override public void log(int arg0, String arg1, Throwable e) { switch (arg0) { case LogChute.DEBUG_ID: log.debug(arg1, e); break; case LogChute.TRACE_ID: log.trace(arg1, e); break; case LogChute.INFO_ID: log.info(arg1, e); break; case LogChute.WARN_ID: log.warn(arg1, e); break; case LogChute.ERROR_ID: log.error(arg1, e); break; default: log.fatal(arg1, e); } }
@Override public void log(int level, String msg) { switch(level) { case LogChute.DEBUG_ID: Log.d(tag,msg); break; case LogChute.ERROR_ID: Log.e(tag,msg); break; case LogChute.INFO_ID: Log.i(tag,msg); break; case LogChute.TRACE_ID: Log.d(tag,msg); break; case LogChute.WARN_ID: Log.w(tag,msg); } }
@Override public void log(int level, String msg, Throwable t) { switch(level) { case LogChute.DEBUG_ID: Log.d(tag,msg,t); break; case LogChute.ERROR_ID: Log.e(tag,msg,t); break; case LogChute.INFO_ID: Log.i(tag,msg,t); break; case LogChute.TRACE_ID: Log.d(tag,msg,t); break; case LogChute.WARN_ID: Log.w(tag,msg,t); } }
/** * @see LogChute#log(int, String) */ public void log(int level, String message) { switch (level) { case LogChute.WARN_ID: log.warn(message); break; case LogChute.INFO_ID: log.info(message); break; case LogChute.TRACE_ID: log.trace(message); break; case LogChute.ERROR_ID: log.error(message); break; case LogChute.DEBUG_ID: default: log.debug(message); break; } }
/** * @see LogChute#log(int, String, Throwable) */ public void log(int level, String message, Throwable t) { switch (level) { case LogChute.WARN_ID: log.warn(message, t); break; case LogChute.INFO_ID: log.info(message, t); break; case LogChute.TRACE_ID: log.trace(message, t); break; case LogChute.ERROR_ID: log.error(message, t); break; case LogChute.DEBUG_ID: default: log.debug(message, t); break; } }
/** * @see LogChute#isLevelEnabled(int) */ public boolean isLevelEnabled(int level) { switch (level) { case LogChute.DEBUG_ID: return log.isDebugEnabled(); case LogChute.INFO_ID: return log.isInfoEnabled(); case LogChute.TRACE_ID: return log.isTraceEnabled(); case LogChute.WARN_ID: return log.isWarnEnabled(); case LogChute.ERROR_ID: return log.isErrorEnabled(); default: return true; } }
@Override public void log(int level, String message) { switch (level) { case LogChute.WARN_ID: logger.warn(message); break; case LogChute.INFO_ID: logger.info(message); break; case LogChute.TRACE_ID: logger.trace(message); break; case LogChute.ERROR_ID: logger.error(message); break; case LogChute.DEBUG_ID: default: logger.debug(message); break; } }
@Override public void log(int level, String message, Throwable t) { switch (level) { case LogChute.WARN_ID: logger.warn(message, t); break; case LogChute.INFO_ID: logger.info(message, t); break; case LogChute.TRACE_ID: logger.trace(message, t); break; case LogChute.ERROR_ID: logger.error(message, t); break; case LogChute.DEBUG_ID: default: logger.debug(message, t); break; } }
@Override public boolean isLevelEnabled(int level) { switch (level) { case LogChute.DEBUG_ID: return logger.isDebugEnabled(); case LogChute.INFO_ID: return logger.isInfoEnabled(); case LogChute.TRACE_ID: return logger.isTraceEnabled(); case LogChute.WARN_ID: return logger.isWarnEnabled(); case LogChute.ERROR_ID: return logger.isErrorEnabled(); default: return true; } }
@Override public void log(int level, String message) { if (isLevelEnabled(level)) { switch (level) { case LogChute.WARN_ID: log(Kind.WARNING, LOG_PREFIX + LogChute.WARN_PREFIX + message); break; case LogChute.ERROR_ID: log(Kind.ERROR, LOG_PREFIX + LogChute.ERROR_PREFIX + message); break; case LogChute.INFO_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.INFO_PREFIX + message); break; case LogChute.DEBUG_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.DEBUG_PREFIX + message); break; case LogChute.TRACE_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.TRACE_PREFIX + message); break; default: logFatal(level); } } }
@Override public void log(int level, String message, Throwable t) { if (isLevelEnabled(level)) { switch (level) { case LogChute.WARN_ID: log(Kind.WARNING, LOG_PREFIX + LogChute.WARN_PREFIX + message, t); break; case LogChute.ERROR_ID: log(Kind.ERROR, LOG_PREFIX + LogChute.ERROR_PREFIX + message, t); break; case LogChute.INFO_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.INFO_PREFIX + message, t); break; case LogChute.DEBUG_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.DEBUG_PREFIX + message, t); break; case LogChute.TRACE_ID: log(Kind.NOTE, LOG_PREFIX + LogChute.TRACE_PREFIX + message, t); break; default: logFatal(level); } } }
@Override public boolean isLevelEnabled(int level) { switch (level) { case LogChute.WARN_ID: return LOG_WARN; case LogChute.ERROR_ID: return LOG_ERROR; case LogChute.INFO_ID: return LOG_INFO; case LogChute.DEBUG_ID: return LOG_DEBUG; case LogChute.TRACE_ID: return LOG_TRACE; default: logFatal(level); return true; } }
/** * Send a log message from Velocity. */ @Override public void log(int level, String message) { switch (level) { case LogChute.WARN_ID: log.warn(message); break; case LogChute.INFO_ID: log.info(message); break; case LogChute.TRACE_ID: log.trace(message); break; case LogChute.ERROR_ID: log.error(message); break; case LogChute.DEBUG_ID: default: log.debug(message); break; } }
/** * Send a log message from Velocity with an error. */ @Override public void log(int level, String message, Throwable t) { switch (level) { case LogChute.WARN_ID: log.warn(message, t); break; case LogChute.INFO_ID: log.info(message, t); break; case LogChute.TRACE_ID: log.trace(message, t); break; case LogChute.ERROR_ID: log.error(message, t); break; case LogChute.DEBUG_ID: default: log.debug(message, t); break; } }
/** * Checks whether the specified log level is enabled. */ @Override public boolean isLevelEnabled(int level) { switch (level) { case LogChute.DEBUG_ID: return log.isDebugEnabled(); case LogChute.INFO_ID: return log.isInfoEnabled(); case LogChute.TRACE_ID: return log.isTraceEnabled(); case LogChute.WARN_ID: return log.isWarnEnabled(); case LogChute.ERROR_ID: return log.isErrorEnabled(); default: return true; } }
protected Level convertLevel(int lvl) { switch (lvl) { case TRACE_ID: return Level.FINER; case LogChute.DEBUG_ID: return Level.FINE; case INFO_ID: return Level.INFO; case WARN_ID: return Level.WARNING; case ERROR_ID: return Level.SEVERE; default: return Level.INFO; } }
/** * Send a log message from Velocity. */ public void log(int level, String message) { switch (level) { case LogChute.WARN_ID: log.warn(message); break; case LogChute.INFO_ID: log.info(message); break; case LogChute.TRACE_ID: log.trace(message); break; case LogChute.ERROR_ID: log.error(message); break; case LogChute.DEBUG_ID: default: log.debug(message); break; } }
/** * Send a log message from Velocity with an error. */ public void log(int level, String message, Throwable t) { switch (level) { case LogChute.WARN_ID: log.warn(message, t); break; case LogChute.INFO_ID: log.info(message, t); break; case LogChute.TRACE_ID: log.trace(message, t); break; case LogChute.ERROR_ID: log.error(message, t); break; case LogChute.DEBUG_ID: default: log.debug(message, t); break; } }
/** * Checks whether the specified log level is enabled. */ public boolean isLevelEnabled(int level) { switch (level) { case LogChute.DEBUG_ID: return log.isDebugEnabled(); case LogChute.INFO_ID: return log.isInfoEnabled(); case LogChute.TRACE_ID: return log.isTraceEnabled(); case LogChute.WARN_ID: return log.isWarnEnabled(); case LogChute.ERROR_ID: return log.isErrorEnabled(); default: return true; } }
public void log( int level, String message ) { switch ( level ) { case LogChute.WARN_ID: getLog().warn( message ); break; case LogChute.INFO_ID: // velocity info messages are too verbose, just consider them as debug messages... getLog().debug( message ); break; case LogChute.DEBUG_ID: getLog().debug( message ); break; case LogChute.ERROR_ID: getLog().error( message ); break; default: getLog().debug( message ); break; } }
public void log( int level, String message, Throwable t ) { switch ( level ) { case LogChute.WARN_ID: getLog().warn( message, t ); break; case LogChute.INFO_ID: // velocity info messages are too verbose, just consider them as debug messages... getLog().debug( message, t ); break; case LogChute.DEBUG_ID: getLog().debug( message, t ); break; case LogChute.ERROR_ID: getLog().error( message, t ); break; default: getLog().debug( message, t ); break; } }
/** * Return the Velocity Engine initialization log level. * * @return the Velocity Engine initialization log level */ protected Integer getInitLogLevel() { // Set Velocity log levels Integer initLogLevel = LogChute.ERROR_ID; Mode mode = ratelConfig.getMode(); if (mode == Mode.DEVELOPMENT) { initLogLevel = LogChute.WARN_ID; } else if (mode == Mode.DEBUG) { initLogLevel = LogChute.WARN_ID; } else if (mode == Mode.TRACE) { initLogLevel = LogChute.INFO_ID; } return initLogLevel; }
/** * Tell whether or not a log level is enabled. * * @see LogChute#isLevelEnabled(int) * * @param level the logging level to test * @return true if the given logging level is enabled */ @Override public boolean isLevelEnabled(int level) { if (level <= LogChute.TRACE_ID && logger.isTraceEnabled()) { return true; } else if (level <= LogChute.DEBUG_ID && logger.isDebugEnabled()) { return true; } else if (level <= LogChute.INFO_ID && logger.isInfoEnabled()) { return true; } else if (level == LogChute.WARN_ID || level == LogChute.ERROR_ID) { return true; } else { return false; } }
/********** LogChute methods *************/ @Override public void init(RuntimeServices rs) { String name = (String) rs.getProperty(LOGCHUTE_SLF4J_NAME); if (name == null) { name = DEFAULT_LOG_NAME; } log = LoggerFactory.getLogger(name); log(LogChute.DEBUG_ID, "Slf4jLogChute name is '" + name + "'"); }
/********** LogChute methods *************/ public void init(RuntimeServices rs) { String name = (String)rs.getProperty(LOGCHUTE_SLF4J_NAME); if (name == null) { name = DEFAULT_LOG_NAME; } log = LoggerFactory.getLogger(name); log(LogChute.DEBUG_ID, "Slf4jLogChute name is '" + name + "'"); }
@Override public boolean isLevelEnabled(int level) { return level > LogChute.DEBUG_ID; }