Class Logger
java.lang.Object
com.chrisnewland.freelogj.Logger
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final Stringprivate final DateTimeFormatter(package private) static final DateTimeFormatterprivate final Logger.LogLevelprivate final PrintStream -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLogger(Class<?> clazz, Logger.LogLevel logLevel, DateTimeFormatter dateFormat, PrintStream printStream) -
Method Summary
Modifier and TypeMethodDescriptionvoidOutput a message at the DEBUGLogger.LogLevel.voidOutput a message at the ERRORLogger.LogLevel.voidOutput a message at the FATALLogger.LogLevel.static LoggerReturns a Logger for the given Class.static LoggergetLogger(Class<?> clazz, Logger.LogLevel logLevel) Returns a Logger for the given Class and LogLevel.static LoggergetLogger(Class<?> clazz, Logger.LogLevel logLevel, PrintStream printStream) Returns a Logger for the given Class and LogLevel andPrintStream.static LoggergetLogger(Class<?> clazz, Logger.LogLevel logLevel, DateTimeFormatter dateFormat, PrintStream printStream) Returns a Logger for the given Class, LogLevel,DateTimeFormatter, andPrintStream.voidOutput a message at the INFOLogger.LogLevel.booleanbooleanbooleanbooleanbooleanbooleanprivate voidlog(Logger.LogLevel logLevel, String message, Object... args) voidOutput a message at the TRACELogger.LogLevel.voidOutput a message at the WARNLogger.LogLevel.
-
Field Details
-
DEFAULT_DATE_FORMAT
-
BRACES
- See Also:
-
className
-
logLevel
-
dateFormat
-
printStream
-
-
Constructor Details
-
Logger
private Logger(Class<?> clazz, Logger.LogLevel logLevel, DateTimeFormatter dateFormat, PrintStream printStream)
-
-
Method Details
-
getLogger
-
getLogger
Returns a Logger for the given Class and LogLevel. The fully qualified class name is printed on each log line.- Parameters:
clazz- The class to be logged
-
getLogger
Returns a Logger for the given Class and LogLevel andPrintStream. The fully qualified class name is printed on each log line.- Parameters:
clazz- The class to be logged
-
getLogger
public static Logger getLogger(Class<?> clazz, Logger.LogLevel logLevel, DateTimeFormatter dateFormat, PrintStream printStream) Returns a Logger for the given Class, LogLevel,DateTimeFormatter, andPrintStream. The fully qualified class name is printed on each log line.- Parameters:
clazz- The class to be logged
-
isTraceEnabled
public boolean isTraceEnabled()- Returns:
- true if the TRACE
Logger.LogLevelis enabled.
-
isDebugEnabled
public boolean isDebugEnabled()- Returns:
- true if the DEBUG
Logger.LogLevelis enabled.
-
isInfoEnabled
public boolean isInfoEnabled()- Returns:
- true if the INFO
Logger.LogLevelis enabled.
-
isWarnEnabled
public boolean isWarnEnabled()- Returns:
- true if the WARN
Logger.LogLevelis enabled.
-
isErrorEnabled
public boolean isErrorEnabled()- Returns:
- true if the ERROR
Logger.LogLevelis enabled.
-
isFatalEnabled
public boolean isFatalEnabled()- Returns:
- true if the FATAL
Logger.LogLevelis enabled.
-
trace
Output a message at the TRACELogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
debug
Output a message at the DEBUGLogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
info
Output a message at the INFOLogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
warn
Output a message at the WARNLogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
error
Output a message at the ERRORLogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
fatal
Output a message at the FATALLogger.LogLevel.- Parameters:
message- The message to output.args- Arguments to be substituted for {} in the message String.
-
log
-