Package ghidra.util

Class Msg


  • public class Msg
    extends java.lang.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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void debug​(java.lang.Object originator, java.lang.Object message)
      Used to record a debug message to the log file.
      static void debug​(java.lang.Object originator, java.lang.Object message, java.lang.Throwable throwable)
      Used to record a debug message to the log file.
      static void error​(java.lang.Object originator, java.lang.Object message)
      Used to display an error message with no available Throwable to the user via the console (no GUI).
      static void error​(java.lang.Object originator, java.lang.Object message, java.lang.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​(java.lang.Object originator, java.lang.Object message)
      Used to display an informational message to the user via the console (no GUI).
      static void info​(java.lang.Object originator, java.lang.Object message, java.lang.Throwable throwable)
      Used to display an informational message to the user via the console (no GUI).
      static void out​(java.lang.Object message)
      Useful for printing temporary messages without any logging markup.
      static void setErrorDisplay​(ErrorDisplay errDisplay)
      Sets the error display (by default it's console)
      static void setErrorLogger​(ErrorLogger errLogger)
      Sets the error logger (by default it's a DefaultErrorLogger).
      static void showError​(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message)
      Used to display an error message with no available Throwable to the user with a pop-up GUI dialog.
      static void showError​(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message, java.lang.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​(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message)
      Used to display an informational message to the user with a pop-up GUI dialog.
      static void showWarn​(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message)
      Used to display a warning message to the user with a pop-up GUI dialog.
      static void showWarn​(java.lang.Object originator, java.awt.Component parent, java.lang.String title, java.lang.Object message, java.lang.Throwable throwable)
      Used to display a warning message to the user with a pop-up GUI dialog.
      static void trace​(java.lang.Object originator, java.lang.Object message)
      Used to record a trace message to the log file.
      static void trace​(java.lang.Object originator, java.lang.Object message, java.lang.Throwable throwable)
      Used to record a trace message to the log file.
      static void warn​(java.lang.Object originator, java.lang.Object message)
      Used to display a warning message to the user via the console (no GUI).
      static void warn​(java.lang.Object originator, java.lang.Object message, java.lang.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 Detail

      • 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​(java.lang.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​(java.lang.Object originator,
                                 java.lang.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​(java.lang.Object originator,
                                 java.lang.Object message,
                                 java.lang.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​(java.lang.Object originator,
                                 java.lang.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​(java.lang.Object originator,
                                 java.lang.Object message,
                                 java.lang.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​(java.lang.Object originator,
                                java.lang.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​(java.lang.Object originator,
                                java.lang.Object message,
                                java.lang.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​(java.lang.Object originator,
                                    java.awt.Component parent,
                                    java.lang.String title,
                                    java.lang.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​(java.lang.Object originator,
                                java.lang.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​(java.lang.Object originator,
                                java.lang.Object message,
                                java.lang.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​(java.lang.Object originator,
                                    java.awt.Component parent,
                                    java.lang.String title,
                                    java.lang.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
      • showWarn

        public static void showWarn​(java.lang.Object originator,
                                    java.awt.Component parent,
                                    java.lang.String title,
                                    java.lang.Object message,
                                    java.lang.Throwable throwable)
        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
        throwable - the Throwable that describes the cause of the warning
      • error

        public static void error​(java.lang.Object originator,
                                 java.lang.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​(java.lang.Object originator,
                                 java.lang.Object message,
                                 java.lang.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​(java.lang.Object originator,
                                     java.awt.Component parent,
                                     java.lang.String title,
                                     java.lang.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​(java.lang.Object originator,
                                     java.awt.Component parent,
                                     java.lang.String title,
                                     java.lang.Object message,
                                     java.lang.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