Class BufferedLogger

java.lang.Object
ml.karmaconfigs.api.common.utils.KarmaLogger
ml.karmaconfigs.api.common.BufferedLogger
All Implemented Interfaces:
Serializable, AutoCloseable

public final class BufferedLogger extends KarmaLogger implements Serializable
Karma logger
See Also:
Serialized Form
  • Constructor Details

    • BufferedLogger

      public BufferedLogger(@NotNull @NotNull KarmaSource s)
      Initialize the logger
      Parameters:
      s - the logger source
  • Method Details

    • calendar

      public BufferedLogger calendar(LogCalendar calendar)
      Set the logger calendar type
      Parameters:
      calendar - the logger calendar
      Returns:
      this instance
    • extension

      public BufferedLogger extension(LogExtension 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:
      scheduleLog in class KarmaLogger
      Parameters:
      level - the log level
      info - the info to log
      replaces - the info replaces
    • scheduleLog

      public void scheduleLog(@NotNull @NotNull Level level, @NotNull @NotNull Throwable error)
      Run the log function on a new thread
      Specified by:
      scheduleLog in class KarmaLogger
      Parameters:
      level - the log level
      error - the error to log
    • scheduleLogOption

      public void scheduleLogOption(Level level, boolean print, CharSequence info, Object... replaces)
      Run the log function on a new thread
      Specified by:
      scheduleLogOption in class KarmaLogger
      Parameters:
      level - the log level
      print - print info to console
      info - the info to log
      replaces - the info replaces
    • scheduleLogOption

      public void scheduleLogOption(Level level, boolean print, Throwable error)
      Run the log function on a new thread
      Specified by:
      scheduleLogOption in class KarmaLogger
      Parameters:
      level - the log level
      print - print info to console
      error - the error to log
    • syncedLog

      public void syncedLog(Level level, CharSequence info, Object... replaces)
      Run the log function on the main known thread
      Specified by:
      syncedLog in class KarmaLogger
      Parameters:
      level - the log level
      info - the info to log
      replaces - the info replaces
    • syncedLog

      public void syncedLog(Level level, Throwable error)
      Run the log function on the main known thread
      Specified by:
      syncedLog in class KarmaLogger
      Parameters:
      level - the log level
      error - the error to log
    • syncedLogOption

      public void syncedLogOption(Level level, boolean print, CharSequence info, Object... replaces)
      Run the log function on the main known thread
      Specified by:
      syncedLogOption in class KarmaLogger
      Parameters:
      level - the log level
      print - print info to console
      info - the info to log
      replaces - the info replaces
    • syncedLogOption

      public void syncedLogOption(Level level, boolean print, Throwable error)
      Run the log function on the main known thread
      Specified by:
      syncedLogOption in class KarmaLogger
      Parameters:
      level - the log level
      print - print info to console
      error - the error to log
    • clearLog

      public void clearLog()
      Clear the log info
      Specified by:
      clearLog in class KarmaLogger
    • 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 overriding KarmaLogger.getLoggerFile(LogExtension) DOES NOTHING ON Logger
      Specified by:
      flush in class KarmaLogger
      Returns:
      if the log could be flushed
    • getLoggerFile

      protected Path getLoggerFile(LogExtension type)
      Get the today's logger file
      Overrides:
      getLoggerFile in class KarmaLogger
      Parameters:
      type - the log extension file type
      Returns:
      the today's logger file