Record Class AlertEvent

java.lang.Object
java.lang.Record
com.github.catomat0.aoploghelper.alert.AlertEvent

public record AlertEvent(Instant timestamp, String level, String loggerName, String threadName, String message, Map<String,String> mdc, String stackTrace) extends Record
Immutable snapshot of a log event captured for asynchronous webhook delivery.

The appender takes this snapshot on the logging thread and hands it to a dispatcher so we never block the calling code waiting for the HTTP call.

  • Constructor Details

    • AlertEvent

      public AlertEvent(Instant timestamp, String level, String loggerName, String threadName, String message, Map<String,String> mdc, String stackTrace)
      Creates an instance of a AlertEvent record class.
      Parameters:
      timestamp - the value for the timestamp record component
      level - the value for the level record component
      loggerName - the value for the loggerName record component
      threadName - the value for the threadName record component
      message - the value for the message record component
      mdc - the value for the mdc record component
      stackTrace - the value for the stackTrace record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • level

      public String level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • loggerName

      public String loggerName()
      Returns the value of the loggerName record component.
      Returns:
      the value of the loggerName record component
    • threadName

      public String threadName()
      Returns the value of the threadName record component.
      Returns:
      the value of the threadName record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • mdc

      public Map<String,String> mdc()
      Returns the value of the mdc record component.
      Returns:
      the value of the mdc record component
    • stackTrace

      public String stackTrace()
      Returns the value of the stackTrace record component.
      Returns:
      the value of the stackTrace record component