/** * Return a logger named corresponding to the class passed as parameter, using the statically bound {@link ILoggerFactory} * instance. * * @param clazz the returned logger will be named after clazz * @return logger */ public static Logger getLogger( Class<?> clazz ) { return new Logger(LoggerFactory.getLogger(clazz)); }
/** * Get the logging level at which this logger is current set. * * @return the current logging level */ public Level getLevel() { if (this.isTraceEnabled()) return Level.TRACE; if (this.isDebugEnabled()) return Level.DEBUG; if (this.isInfoEnabled()) return Level.INFO; if (this.isWarnEnabled()) return Level.WARNING; if (this.isErrorEnabled()) return Level.ERROR; return Level.OFF; }
switch (level) { case DEBUG: debug(t, message.text(LOGGING_LOCALE.get(), params)); break; case ERROR: error(t, message, params); break; case INFO: info(t, message, params); break; case TRACE: trace(t, message.text(LOGGING_LOCALE.get(), params)); break; case WARNING: warn(t, message, params); break; case OFF:
/** * Log an exception (throwable) at the ERROR level with an accompanying message. If the exception is null, then this method * calls {@link #error(I18n, Object...)}. * * @param t the exception (throwable) to log * @param message the message accompanying the exception * @param params the parameter values that are to replace the variables in the format string */ public void error( Throwable t, I18n message, Object... params ) { if (!isErrorEnabled()) return; if (t == null) { error(message, params); return; } if (message == null) { this.delegate.error(null, t); return; } this.delegate.error(message.text(LOGGING_LOCALE.get(), params), t); }
/** * Log an exception (throwable) at the DEBUG level with an accompanying message. If the exception is null, then this method * calls {@link #debug(String, Object...)}. * * @param t the exception (throwable) to log * @param message the message accompanying the exception * @param params the parameter values that are to replace the variables in the format string */ public void debug( Throwable t, String message, Object... params ) { if (!isDebugEnabled()) return; if (t == null) { debug(message, params); return; } if (message == null) { this.delegate.debug(null, t); return; } this.delegate.debug(StringUtil.createString(message, params), t); }
/** * Log an exception (throwable) at the TRACE level with an accompanying message. If the exception is null, then this method * calls {@link #trace(String, Object...)}. * * @param t the exception (throwable) to log * @param message the message accompanying the exception * @param params the parameter values that are to replace the variables in the format string */ public void trace( Throwable t, String message, Object... params ) { if (!isTraceEnabled()) return; if (t == null) { this.trace(message, params); return; } if (message == null) { this.delegate.trace(null, t); return; } this.delegate.trace(StringUtil.createString(message, params), t); }
/** * Log an exception (throwable) at the INFO level with an accompanying message. If the exception is null, then this method * calls {@link #info(I18n, Object...)}. * * @param t the exception (throwable) to log * @param message the message accompanying the exception * @param params the parameter values that are to replace the variables in the format string */ public void info( Throwable t, I18n message, Object... params ) { if (!isInfoEnabled()) return; if (t == null) { info(message, params); return; } if (message == null) { this.delegate.info(null, t); return; } this.delegate.info(message.text(LOGGING_LOCALE.get(), params), t); }
/** * Log an exception (throwable) at the WARNING level with an accompanying message. If the exception is null, then this method * calls {@link #warn(I18n, Object...)}. * * @param t the exception (throwable) to log * @param message the message accompanying the exception * @param params the parameter values that are to replace the variables in the format string */ public void warn( Throwable t, I18n message, Object... params ) { if (!isWarnEnabled()) return; if (t == null) { warn(message, params); return; } if (message == null) { this.delegate.warn(null, t); return; } this.delegate.warn(message.text(LOGGING_LOCALE.get(), params), t); }
/** * Log a message at the ERROR level according to the specified format and (optional) parameters. The message should contain a * pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient * and avoids superfluous object creation when the logger is disabled for the ERROR level. * * @param message the message string * @param params the parameter values that are to replace the variables in the format string */ public void error( I18n message, Object... params ) { if (!isErrorEnabled()) return; if (message == null) return; this.delegate.error(message.text(LOGGING_LOCALE.get(), params)); }
/** * Log a message at the INFO level according to the specified format and (optional) parameters. The message should contain a * pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient * and avoids superfluous object creation when the logger is disabled for the INFO level. * * @param message the message string * @param params the parameter values that are to replace the variables in the format string */ public void info( I18n message, Object... params ) { if (!isInfoEnabled()) return; if (message == null) return; this.delegate.info(message.text(LOGGING_LOCALE.get(), params)); }
/** * Log a message at the TRACE level according to the specified format and (optional) parameters. The message should contain a * pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient * and avoids superfluous object creation when the logger is disabled for the TRACE level. * * @param message the message string * @param params the parameter values that are to replace the variables in the format string */ public void trace( String message, Object... params ) { if (!isTraceEnabled()) return; if (message == null) return; this.delegate.trace(StringUtil.createString(message, params)); }
/** * Log a message at the WARNING level according to the specified format and (optional) parameters. The message should contain * a pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is * efficient and avoids superfluous object creation when the logger is disabled for the WARNING level. * * @param message the message string * @param params the parameter values that are to replace the variables in the format string */ public void warn( I18n message, Object... params ) { if (!isWarnEnabled()) return; if (message == null) return; this.delegate.warn(message.text(LOGGING_LOCALE.get(), params)); }
/** * Log a message at the DEBUG level according to the specified format and (optional) parameters. The message should contain a * pair of empty curly braces for each of the parameter, which should be passed in the correct order. This method is efficient * and avoids superfluous object creation when the logger is disabled for the DEBUG level. * * @param message the message string * @param params the parameter values that are to replace the variables in the format string */ public void debug( String message, Object... params ) { if (!isDebugEnabled()) return; if (message == null) return; this.delegate.debug(StringUtil.createString(message, params)); }
/** * Return a logger named according to the name parameter using the statically bound {@link ILoggerFactory} instance. * * @param name The name of the logger. * @return logger */ public static Logger getLogger( String name ) { return new Logger(LoggerFactory.getLogger(name)); }