Class StampedMessage

  • All Implemented Interfaces:
    Serializable

    @JsonClassDescription("A message associated with a timestamp, akin to a log message from any logger tool")
    public class StampedMessage
    extends Object
    implements Serializable
    Implements a timestamped log message similar to what would be captured by a logging framework.

    However, this one can be passed around as a VO for UI and other purposes.

    It is serialized to JSON by StampedMessageSerializer.

    See Also:
    Serialized Form
    • Constructor Detail

      • StampedMessage

        public StampedMessage​(LogLevel level,
                              String message)
        Creates a basic log of the given level with the given string message
        Parameters:
        level - The log level
        message - The message
      • StampedMessage

        public StampedMessage​(LogLevel level,
                              String message,
                              Throwable exception)
        Full constructor taking a level, a message, and an exception.

        The log timestamp will be the system timestamp when this constructor is invoked.

        Parameters:
        level - The log level
        message - The string message
        exception - The exception (or null)
      • StampedMessage

        public StampedMessage​(sailpoint.tools.Message message)
        Creates a log from a SailPoint Message object
        Parameters:
        message - A Sailpoint message
      • StampedMessage

        public StampedMessage​(sailpoint.tools.Message message,
                              Throwable throwable)
        Creates a log from a SailPoint Message object and a throwable
        Parameters:
        message - The message object
        throwable - The error object
      • StampedMessage

        public StampedMessage​(String message)
        Creates a basic INFO level log with the given string message
        Parameters:
        message - The string message
      • StampedMessage

        public StampedMessage​(String message,
                              Throwable throwable)
        Creates a log of ERROR level with the given message and Throwable
        Parameters:
        message - The message to log
        throwable - The throwable to log
      • StampedMessage

        public StampedMessage​(Throwable throwable)
        Creates a log of ERROR level with the given Throwable, using its getMessage() as the message
        Parameters:
        throwable - The throwable to log
    • Method Detail

      • getException

        public Throwable getException()
        Gets the exception associated with this LogMessage
        Returns:
        The exception, or null
      • getLevel

        public LogLevel getLevel()
        Gets the log level associated with this LogMessage
        Returns:
        The log level, never null
      • getMessage

        public String getMessage()
        Gets the log message
        Returns:
        The log message
      • getTimestamp

        public long getTimestamp()
        Gets the millisecond timestamp when this object was created
        Returns:
        The millisecond timestamp of creation
      • isDebug

        public boolean isDebug()
        Returns true if the log level of this message is exactly DEBUG
      • isError

        public boolean isError()
        Returns true if the log level of this message is exactly ERROR
      • isInfo

        public boolean isInfo()
        Returns true if the log level of this message is exactly INFO
      • isInfoOrHigher

        public boolean isInfoOrHigher()
        Returns true if the log level of this message is INFO, WARN, or ERROR
      • isWarning

        public boolean isWarning()
        Returns true if the log level of this message is WARN
      • isWarningOrHigher

        public boolean isWarningOrHigher()
        Returns true if the log level of this message is WARN or ERROR
      • toString

        public String toString()
        Transforms this object into a log4j-type log string.

        Example: 2024-04-15 14:42:31.112 [Thread-10] [DEBUG] Your message

        Overrides:
        toString in class Object