Package com.github.nedelis.jc4j.logging
Class JC4JLogger
java.lang.Object
com.github.nedelis.jc4j.logging.JC4JLogger
Custom logger of the library. This logger is wrapper for the System.out.println() function
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJC4JLogger(String name, Path pathToLogFile, @org.jetbrains.annotations.Range(from=0L, to=7L) int logLevel, JC4JLoggerMessagePattern pattern) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoiddisable()Disables logger<R> RdoWithoutLogging(@NotNull NoParamsFunction<R> func) This function allows to do any other function without loggingvoiddoWithoutLogging(@NotNull Procedure proc) This procedure allows to do any other procedure without loggingvoidenable()Enables loggervoidvoidvoidPrints the given message, stores it in themessagesand shuts down the programvoidDo the same thing asfatal(String), but also prints the given throwablevoidvoidbooleanChecks whether the logger is enabled or notintlogLevel()name()voidvoidvoidvoid
-
Constructor Details
-
JC4JLogger
protected JC4JLogger(String name, Path pathToLogFile, @org.jetbrains.annotations.Range(from=0L, to=7L) int logLevel, JC4JLoggerMessagePattern pattern)
-
-
Method Details
-
trace
-
trace
-
debug
-
debug
-
info
-
info
-
warn
-
warn
-
error
-
error
-
fatal
Prints the given message, stores it in themessagesand shuts down the program- Parameters:
msg- message to be printed
-
fatal
Do the same thing asfatal(String), but also prints the given throwable- Parameters:
t- throwable to be printedmsg- message to be printed
-
doWithoutLogging
This function allows to do any other function without logging- Type Parameters:
R- type of the function's return value- Parameters:
func- returnable function without params- Returns:
- result of the given function
-
doWithoutLogging
This procedure allows to do any other procedure without logging- Parameters:
proc- procedure that will be executed
-
disable
public void disable()Disables logger -
enable
public void enable()Enables logger -
isEnabled
public boolean isEnabled()Checks whether the logger is enabled or not- Returns:
- true if the logger is enabled
-
name
- Returns:
- name of the logger
-
logLevel
public int logLevel()- Returns:
- level of the logger
-