Class TextOrGUILogger

java.lang.Object
com.xinapse.util.logging.TextOrGUILogger

public final class TextOrGUILogger extends Object
A Logger that logs to either:
  • System.out (for FINE and FINER messages) and System.err (for WARNING and SEVERE messages), for command-line programs, or
  • A pop-up error console, for GUI programs. Only SEVERE messages are logged; all others are ignored.
  • Field Details

    • ERROR_ONLY_LOGGER

      public static final Logger ERROR_ONLY_LOGGER
      A Logger that logs only SEVERE (error) messages to the terminal or the pop-up error console. Give the logger a name that differentiates it from the logger created by the program Jim, otherwise logging messages will be duplicated by the 2 loggers.
  • Method Details

    • getLogger

      public static Logger getLogger(String name)
      Returns a TextOrGUILogger with the given name.
      Parameters:
      name - a name for the logger.
      Returns:
      a TextOrGUILogger with the given name.
    • startProgressBar

      public static void startProgressBar(Logger logger, String initialMessage, int nSteps)
      Starts showing a progress bar if the logging level is Finer.
      Parameters:
      logger - the Logger, which must be TextOrGUILogger.
      initialMessage - the initial message to show before the bar.
      nSteps - the number of progress steps to reach 100%.
    • setProgress

      public static void setProgress(Logger logger, int step)
      Sets the amount of progress shown by the progress bar.
      Parameters:
      logger - the Logger, which must be TextOrGUILogger.
      step - the step number out the of the total number of steps.
    • endProgressBar

      public static void endProgressBar(Logger logger)
      Sets the progress bar to 100%, and ends the progress bar.
      Parameters:
      logger - the Logger, which must be TextOrGUILogger.
    • endProgressBar

      public static void endProgressBar(Logger logger, String finalMessage)
      Sets the progress bar to 100%, and ends the progress bar with a final message.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      finalMessage - the final message.
    • startTwiddler

      public static void startTwiddler(Logger logger, String initialMessage)
      Starts a Twiddler.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      initialMessage - the initial message to show before the twiddler.
    • twiddle

      public static void twiddle(Logger logger)
      Twiddles the twidder.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
    • stopTwiddler

      public static void stopTwiddler(Logger logger)
      Stops the twidder.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
    • stopTwiddler

      public static void stopTwiddler(Logger logger, String finalMessage)
      Stops the twidder with a final message.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      finalMessage - the final message.
    • startProgressiveOutput

      public static void startProgressiveOutput(Logger logger, String initialMessage)
      Starts showing some progresive output.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      initialMessage - the initial message to show.
    • continueProgressiveOutput

      public static void continueProgressiveOutput(Logger logger, String message)
      Shows some more progresive output.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      message - the next message to show.
    • finishProgressiveOutput

      public static void finishProgressiveOutput(Logger logger)
      Finishes the progresive output.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
    • finishProgressiveOutput

      public static void finishProgressiveOutput(Logger logger, String finalMessage)
      Finishes the progresive output with a final message.
      Parameters:
      logger - the Logger, which must be a TextOrGUILogger.
      finalMessage - the final message.
    • main

      public static void main(String[] args)
      Run the self-text on this class.
      Parameters:
      args - ignored.