Module org.autogui

Class GuiLogManagerConsole

java.lang.Object
org.autogui.base.log.GuiLogManager
org.autogui.base.log.GuiLogManagerConsole

public class GuiLogManagerConsole extends GuiLogManager
the console based log-manager
  • Field Details

    • out

      protected PrintStream out
    • lastEntry

      protected GuiLogEntry lastEntry
    • controlSequence

      protected boolean controlSequence
    • showStandard

      protected boolean showStandard
      Since:
      1.1
    • barWidth

      public static int barWidth
  • Constructor Details

    • GuiLogManagerConsole

      public GuiLogManagerConsole()
      use current System.err
    • GuiLogManagerConsole

      public GuiLogManagerConsole(PrintStream out)
  • Method Details

    • setOut

      public void setOut(PrintStream out)
    • getOut

      public PrintStream getOut()
    • setControlSequence

      public void setControlSequence(boolean controlSequence)
      Parameters:
      controlSequence - if true, control code with CSI will be printed (default)
    • isControlSequence

      public boolean isControlSequence()
    • isShowStandard

      public boolean isShowStandard()
      Returns:
      showing string entries created by stdout redirection. default is true
      Since:
      1.1
    • setShowStandard

      public void setShowStandard(boolean showStandard)
      Parameters:
      showStandard - if true, showing string entries created by stdout redirection
      Since:
      1.1
    • getErr

      public PrintStream getErr()
      Overrides:
      getErr in class GuiLogManager
    • logString

      public GuiLogEntryString logString(String str, boolean fromStandard)
      Description copied from class: GuiLogManager
      create a string entry and show it.
      Overrides:
      logString in class GuiLogManager
      Parameters:
      str - the string for the entry
      fromStandard - whether the string come from the standard output (or error) redirection
      Returns:
      the created log entry
    • showString

      public void showString(GuiLogEntryString s)
    • logError

      public GuiLogEntryException logError(Throwable ex)
      Description copied from class: GuiLogManager
      create an exception entry and show it
      Overrides:
      logError in class GuiLogManager
      Parameters:
      ex - the exception
      Returns:
      the created entry
    • showError

      public void showError(GuiLogEntryException e)
    • logProgress

      public GuiLogEntryProgress logProgress()
      Description copied from class: GuiLogManager
      create an active progress entry and show it. the returned progress is determinate (isIndeterminate() == false), and notifies progress changes to the manager by GuiLogManager.updateProgress(GuiLogEntryProgress)
           try (GuiLogEntryProgress p = manager.logProgress();) {
               for (...) {
                   //those methods will cause a runtime-exception if the thread is interrupted.
                   p.addValueP(0.01f)
                     .setMessage("running ...");
                   ...
                   //the running code can checks interruption
                   if (Thread.interrupted()) {
                       break;
                   }
                   ...
               }
           } catch (Exception ex) { ... }
       
      Overrides:
      logProgress in class GuiLogManager
      Returns:
      the created progress entry
    • showProgress

      public void showProgress(GuiLogEntryProgress p)
    • updateProgress

      public void updateProgress(GuiLogEntryProgress p)
      Overrides:
      updateProgress in class GuiLogManager
    • show

      public void show(GuiLogEntry e)
      Description copied from class: GuiLogManager
      update display of the entry.
      Overrides:
      show in class GuiLogManager
      Parameters:
      e - the displayed entry
    • formatDurationIndeterminate

      public String formatDurationIndeterminate(Duration d)
    • formatBar

      public String formatBar(double p)