Class LogMessage

java.lang.Object
mars.assembler.log.LogMessage

public class LogMessage extends Object
Represents occurrence of an error detected during tokenizing, assembly or simulation.
Author:
Pete Sanderson, August 2003; Sean Clarke, October 2024
  • Constructor Details

    • LogMessage

      public LogMessage(LogLevel level, SourceLocation location, String content)
      Create a new LogMessage.
      Parameters:
      level - The level of the message.
      location - The location in the source code the message refers to.
      content - The textual content of the message.
  • Method Details

    • info

      public static LogMessage info(SourceLocation location, String content)
      Create a new LogMessage with level LogLevel.INFO.
      Parameters:
      location - The location in the source code the message refers to.
      content - The textual content of the message.
    • warning

      public static LogMessage warning(SourceLocation location, String content)
      Create a new LogMessage with level LogLevel.WARNING.
      Parameters:
      location - The location in the source code the message refers to.
      content - The textual content of the message.
    • error

      public static LogMessage error(SourceLocation location, String content)
      Create a new LogMessage with level LogLevel.ERROR.
      Parameters:
      location - The location in the source code the message refers to.
      content - The textual content of the message.
    • getLevel

      public LogLevel getLevel()
      Get the level of this message.
      Returns:
      The level of this message.
    • getLocation

      public SourceLocation getLocation()
      Get the location in the source code this message refers to.
      Returns:
      The location in the source code this message refers to, or null if this message does not reference any particular location in the source code.
    • getContent

      public String getContent()
      Get the textual content of this message.
      Returns:
      The textual content of this message.
    • toString

      public String toString()
      Convert this message to a string for the purpose of displaying to the user. This string representation may take up multiple lines, but does not end with a newline.
      Overrides:
      toString in class Object
      Returns:
      This message converted to string form.