Package ghidra.util

Class Msg

java.lang.Object
ghidra.util.Msg

public class Msg extends Object
Class with static methods to report errors as either a short message or a more detailed message (e.g., stacktrace).

The 'message' parameter for these calls is typically a String. However, it can also be a log4j Message object as well. (See log4j2 for details.)

  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    debug(Object originator, Object message)
    Used to record a debug message to the log file.
    static void
    debug(Object originator, Object message, Throwable throwable)
    Used to record a debug message to the log file.
    static void
    error(Object originator, Object message)
    Used to display an error message with no available Throwable to the user via the console (no GUI).
    static void
    error(Object originator, Object message, Throwable throwable)
    Used to display an error message with a Throwable (for stack trace) to the user via the console (no GUI).
    static void
    info(Object originator, Object message)
    Used to display an informational message to the user via the console (no GUI).
    static void
    info(Object originator, Object message, Throwable throwable)
    Used to display an informational message to the user via the console (no GUI).
    static void
    out(Object message)
    Useful for printing temporary messages without any logging markup.
    static void
    Sets the error display (by default it's console)
    static void
    Sets the error logger (by default it's a DefaultErrorLogger).
    static void
    showError(Object originator, Component parent, String title, Object message)
    Used to display an error message with no available Throwable to the user with a pop-up GUI dialog.
    static void
    showError(Object originator, Component parent, String title, Object message, Throwable throwable)
    Used to display an error message with a Throwable (for stack trace) to the user with a pop-up GUI dialog.
    static void
    showInfo(Object originator, Component parent, String title, Object message)
    Used to display an informational message to the user with a pop-up GUI dialog.
    static void
    showWarn(Object originator, Component parent, String title, Object message)
    Used to display a warning message to the user with a pop-up GUI dialog.
    static void
    trace(Object originator, Object message)
    Used to record a trace message to the log file.
    static void
    trace(Object originator, Object message, Throwable throwable)
    Used to record a trace message to the log file.
    static void
    warn(Object originator, Object message)
    Used to display a warning message to the user via the console (no GUI).
    static void
    warn(Object originator, Object message, Throwable throwable)
    Used to display a warning message to the user via the console (no GUI).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • setErrorLogger

      public static void setErrorLogger(ErrorLogger errLogger)
      Sets the error logger (by default it's a DefaultErrorLogger).
      Parameters:
      errLogger - the error logger
    • setErrorDisplay

      public static void setErrorDisplay(ErrorDisplay errDisplay)
      Sets the error display (by default it's console)
      Parameters:
      errDisplay - the error display
    • out

      public static void out(Object message)
      Useful for printing temporary messages without any logging markup. This is meant to be a replacement for System.out.
      Parameters:
      message - the message to print
    • trace

      public static void trace(Object originator, Object message)
      Used to record a trace message to the log file. All calls to this method outside of main methods and JUnit tests will be removed before a production release.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
    • trace

      public static void trace(Object originator, Object message, Throwable throwable)
      Used to record a trace message to the log file. All calls to this method outside of main methods and JUnit tests will be removed before a production release. This may be used to document an exception without elevating that exception to error or warning status.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
      throwable - the Throwable that describes the cause of the error
    • debug

      public static void debug(Object originator, Object message)
      Used to record a debug message to the log file.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
    • debug

      public static void debug(Object originator, Object message, Throwable throwable)
      Used to record a debug message to the log file. This may be used to document an exception without elevating that exception to error or warning status
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
      throwable - the Throwable that describes the cause of the error
    • info

      public static void info(Object originator, Object message)
      Used to display an informational message to the user via the console (no GUI). Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
    • info

      public static void info(Object originator, Object message, Throwable throwable)
      Used to display an informational message to the user via the console (no GUI). Also records the message to the logging system. This may be used to document an exception without elevating that exception to error or warning status.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
      throwable - the Throwable that describes the cause of the error
    • showInfo

      public static void showInfo(Object originator, Component parent, String title, Object message)
      Used to display an informational message to the user with a pop-up GUI dialog. Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      parent - a parent component used to center the dialog (or null if you don't have one)
      title - the title of the pop-up dialog (main subject of message)
      message - the details of the message
    • warn

      public static void warn(Object originator, Object message)
      Used to display a warning message to the user via the console (no GUI). Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
    • warn

      public static void warn(Object originator, Object message, Throwable throwable)
      Used to display a warning message to the user via the console (no GUI). Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
      throwable - a Throwable for printing a stack trace
    • showWarn

      public static void showWarn(Object originator, Component parent, String title, Object message)
      Used to display a warning message to the user with a pop-up GUI dialog. Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      parent - a parent component used to center the dialog (or null if you don't have one)
      title - the title of the pop-up dialog (main subject of message)
      message - the details of the message
    • error

      public static void error(Object originator, Object message)
      Used to display an error message with no available Throwable to the user via the console (no GUI). Also records the message to the logging system. If you have a Throwable, please use the other error(...) method.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
    • error

      public static void error(Object originator, Object message, Throwable throwable)
      Used to display an error message with a Throwable (for stack trace) to the user via the console (no GUI). Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      message - the details of the message
      throwable - the Throwable that describes the cause of the error
    • showError

      public static void showError(Object originator, Component parent, String title, Object message)
      Used to display an error message with no available Throwable to the user with a pop-up GUI dialog. Also records the message to the logging system. If you have a Throwable, please use the other error(...) method.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      parent - a parent component used to center the dialog (or null if you don't have one)
      title - the title of the pop-up dialog (main subject of message)
      message - the details of the message
    • showError

      public static void showError(Object originator, Component parent, String title, Object message, Throwable throwable)
      Used to display an error message with a Throwable (for stack trace) to the user with a pop-up GUI dialog. Also records the message to the logging system.
      Parameters:
      originator - a Logger instance, "this", or YourClass.class
      parent - a parent component used to center the dialog (or null if you don't have one)
      title - the title of the pop-up dialog (main subject of message)
      message - the details of the message
      throwable - the Throwable that describes the cause of the error