Class Logger

All Implemented Interfaces:
Serializable, AutoCloseable

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

    • Logger

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

    • calendar

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

      public Logger 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() throws IllegalStateException
      Clear the log file
      Specified by:
      clearLog in class KarmaLogger
      Throws:
      IllegalStateException - if the log file could not be cleared
    • 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