Package io.airlift.log
Class Logger
- java.lang.Object
-
- io.airlift.log.Logger
-
public class Logger extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(String message)Logs a message at DEBUG level.voiddebug(String format, Object... args)Logs a message at DEBUG level.voiddebug(Throwable exception, String message)Logs a message at DEBUG level.voiddebug(Throwable exception, String format, Object... args)Logs a message at DEBUG level.voiderror(String message)Logs a message at ERROR level.voiderror(String format, Object... args)Logs a message at ERROR level.voiderror(Throwable exception)Logs a message at ERROR level.voiderror(Throwable exception, String message)Logs a message at ERROR level.voiderror(Throwable exception, String format, Object... args)Logs a message at ERROR level.static Loggerget(Class<?> clazz)Gets a logger named after a class' fully qualified name.static Loggerget(String name)Gets a named loggervoidinfo(String message)Logs a message at INFO level.voidinfo(String format, Object... args)Logs a message at INFO level.booleanisDebugEnabled()booleanisInfoEnabled()voidwarn(String message)Logs a message at WARN level.voidwarn(String format, Object... args)Logs a message at WARN level.voidwarn(Throwable exception, String message)Logs a message at WARN level.voidwarn(Throwable exception, String format, Object... args)Logs a message at WARN level.
-
-
-
Method Detail
-
get
public static Logger get(Class<?> clazz)
Gets a logger named after a class' fully qualified name.- Parameters:
clazz- the class- Returns:
- the named logger
-
get
public static Logger get(String name)
Gets a named logger- Parameters:
name- the name of the logger- Returns:
- the named logger
-
debug
public void debug(Throwable exception, String message)
Logs a message at DEBUG level.- Parameters:
exception- an exception associated with the debug message being loggedmessage- a literal message to log
-
debug
public void debug(String message)
Logs a message at DEBUG level.- Parameters:
message- a literal message to log
-
debug
@FormatMethod public void debug(String format, Object... args)
Logs a message at DEBUG level.Usage example:
logger.debug("value is %s (%d ms)", value, time);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
format- a format string compatible with String.format()args- arguments for the format string
-
debug
@FormatMethod public void debug(Throwable exception, String format, Object... args)
Logs a message at DEBUG level.Usage example:
logger.debug(e, "value is %s (%d ms)", value, time);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
exception- an exception associated with the debug message being loggedformat- a format string compatible with String.format()args- arguments for the format string
-
info
public void info(String message)
Logs a message at INFO level.- Parameters:
message- a literal message to log
-
info
@FormatMethod public void info(String format, Object... args)
Logs a message at INFO level.Usage example:
logger.info("value is %s (%d ms)", value, time);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
format- a format string compatible with String.format()args- arguments for the format string
-
warn
public void warn(Throwable exception, String message)
Logs a message at WARN level.- Parameters:
exception- an exception associated with the warning being loggedmessage- a literal message to log
-
warn
public void warn(String message)
Logs a message at WARN level.- Parameters:
message- a literal message to log
-
warn
@FormatMethod public void warn(Throwable exception, String format, Object... args)
Logs a message at WARN level.Usage example:
logger.warn(e, "something bad happened when connecting to %s:%d", host, port);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
exception- an exception associated with the warning being loggedformat- a format string compatible with String.format()args- arguments for the format string
-
warn
@FormatMethod public void warn(String format, Object... args)
Logs a message at WARN level.Usage example:
logger.warn("something bad happened when connecting to %s:%d", host, port);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
format- a format string compatible with String.format()args- arguments for the format string
-
error
public void error(Throwable exception, String message)
Logs a message at ERROR level.- Parameters:
exception- an exception associated with the error being loggedmessage- a literal message to log
-
error
public void error(String message)
Logs a message at ERROR level.- Parameters:
message- a literal message to log
-
error
@FormatMethod public void error(Throwable exception, String format, Object... args)
Logs a message at ERROR level.Usage example:
logger.error(e, "something really bad happened when connecting to %s:%d", host, port);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
exception- an exception associated with the error being loggedformat- a format string compatible with String.format()args- arguments for the format string
-
error
public void error(Throwable exception)
Logs a message at ERROR level. The value ofexception.getMessage()will be used as the log message.Usage example:
logger.error(e);- Parameters:
exception- an exception associated with the error being logged
-
error
@FormatMethod public void error(String format, Object... args)
Logs a message at ERROR level.Usage example:
logger.error("something really bad happened when connecting to %s:%d", host, port);If the format string is invalid or the arguments are insufficient, an error will be logged and execution will continue.- Parameters:
format- a format string compatible with String.format()args- arguments for the format string
-
isDebugEnabled
public boolean isDebugEnabled()
-
isInfoEnabled
public boolean isInfoEnabled()
-
-