Package ml.karmaconfigs.api.common
Class BufferedLogger
java.lang.Object
ml.karmaconfigs.api.common.utils.KarmaLogger
ml.karmaconfigs.api.common.BufferedLogger
- All Implemented Interfaces:
Serializable,AutoCloseable
Karma logger
- See Also:
- Serialized Form
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalendar(LogCalendar calendar)Set the logger calendar typevoidclearLog()Clear the log infoextension(LogExtension extension)Set the logger extension typebooleanflush()Flush the log data if the log auto flush is turned off WARNING: This will replace all the log file content, this should be used only for applications that runs once -> generate a log file and then switch log file.protected PathgetLoggerFile(LogExtension type)Get the today's logger filevoidscheduleLog(@NotNull Level level, @NotNull CharSequence info, @NotNull Object... replaces)Run the log function on a new threadvoidscheduleLog(@NotNull Level level, @NotNull Throwable error)Run the log function on a new threadvoidscheduleLogOption(Level level, boolean print, CharSequence info, Object... replaces)Run the log function on a new threadvoidscheduleLogOption(Level level, boolean print, Throwable error)Run the log function on a new threadvoidsyncedLog(Level level, CharSequence info, Object... replaces)Run the log function on the main known threadvoidRun the log function on the main known threadvoidsyncedLogOption(Level level, boolean print, CharSequence info, Object... replaces)Run the log function on the main known threadvoidsyncedLogOption(Level level, boolean print, Throwable error)Run the log function on the main known threadMethods inherited from class ml.karmaconfigs.api.common.utils.KarmaLogger
close, fetchTime, getLogger, printError, printInfo
-
Constructor Details
-
BufferedLogger
Initialize the logger- Parameters:
s- the logger source
-
-
Method Details
-
calendar
Set the logger calendar type- Parameters:
calendar- the logger calendar- Returns:
- this instance
-
extension
Set the logger extension type- Parameters:
extension- the logger extension- Returns:
- this instance
-
scheduleLog
public void scheduleLog(@NotNull @NotNull Level level, @NotNull @NotNull CharSequence info, @NotNull @NotNull Object... replaces)Run the log function on a new thread- Specified by:
scheduleLogin classKarmaLogger- Parameters:
level- the log levelinfo- the info to logreplaces- the info replaces
-
scheduleLog
Run the log function on a new thread- Specified by:
scheduleLogin classKarmaLogger- Parameters:
level- the log levelerror- the error to log
-
scheduleLogOption
Run the log function on a new thread- Specified by:
scheduleLogOptionin classKarmaLogger- Parameters:
level- the log levelprint- print info to consoleinfo- the info to logreplaces- the info replaces
-
scheduleLogOption
Run the log function on a new thread- Specified by:
scheduleLogOptionin classKarmaLogger- Parameters:
level- the log levelprint- print info to consoleerror- the error to log
-
syncedLog
Run the log function on the main known thread- Specified by:
syncedLogin classKarmaLogger- Parameters:
level- the log levelinfo- the info to logreplaces- the info replaces
-
syncedLog
Run the log function on the main known thread- Specified by:
syncedLogin classKarmaLogger- Parameters:
level- the log levelerror- the error to log
-
syncedLogOption
Run the log function on the main known thread- Specified by:
syncedLogOptionin classKarmaLogger- Parameters:
level- the log levelprint- print info to consoleinfo- the info to logreplaces- the info replaces
-
syncedLogOption
Run the log function on the main known thread- Specified by:
syncedLogOptionin classKarmaLogger- Parameters:
level- the log levelprint- print info to consoleerror- the error to log
-
clearLog
public void clearLog()Clear the log info- Specified by:
clearLogin classKarmaLogger
-
flush
public boolean flush()Flush the log data if the log auto flush is turned off WARNING: This will replace all the log file content, this should be used only for applications that runs once -> generate a log file and then switch log file. You can change the log file by overridingKarmaLogger.getLoggerFile(LogExtension)DOES NOTHING ONLogger- Specified by:
flushin classKarmaLogger- Returns:
- if the log could be flushed
-
getLoggerFile
Get the today's logger file- Overrides:
getLoggerFilein classKarmaLogger- Parameters:
type- the log extension file type- Returns:
- the today's logger file
-