java.lang.Object
net.i2p.util.LogRecord

class LogRecordextends Object
Keep track of a log entry, unformatted.
  • Field Details

    • _date

      private final long _date
      When the message was logged.
    • _source

      private final Class<?> _source
      The class that logged the message.
    • _name

      private final String _name
      The logger's name.
    • _threadName

      private final String _threadName
      The thread that logged the message.
    • _priority

      private final int _priority
      The message's priority.
    • _message

      private final String _message
      The message text.
    • _throwable

      private final Throwable _throwable
      The exception logged with the message, if any.
    • MATCH_LEN

      private static final int MATCH_LEN
      Message prefix length used to match repeats.
      See Also:
  • Constructor Details

    • LogRecord

      public LogRecord(Class<?> src, String name, String threadName, int priority, String msg, Throwable t)
      Captures one log entry, stamping it with the current time.
      Parameters:
      src - the class the entry was logged from
      name - the display name of the logger that wrote the entry
      threadName - the name of the thread that logged it
      priority - the message priority, one of the Log.WARN-style constants
      msg - the unformatted message text
      t - the associated exception, or null if the entry carries none
  • Method Details

    • getDate

      public long getDate()
      Time the record was created.
      Returns:
      the creation time in ms on the router clock
    • getSource

      public Class<?> getSource()
      Class the record is from.
      Returns:
      the Class<?> the entry was logged from
    • getSourceName

      public String getSourceName()
      Name the record is from.
      Returns:
      the source name
    • getThreadName

      public String getThreadName()
      Thread the record was created on.
      Returns:
      the thread name
    • getPriority

      public int getPriority()
      Log priority of the record.
      Returns:
      one of the Log.WARN-style priority constants
    • getMessage

      public String getMessage()
      Message text.
      Returns:
      the unformatted message text
    • getThrowable

      public Throwable getThrowable()
      Throwable attached to the record, if any.
      Returns:
      the associated exception, or null when the entry carries none
    • equals

      public boolean equals(Object o)
      Matches source class, first part of message string, and throwable class only. Used only by LogWriter to eliminate dups.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Hash code derived from the message.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code