Record Class LogEntry

java.lang.Object
java.lang.Record
de.oliver.fancyanalytics.logger.LogEntry
Record Components:
loggerName - The name of the logger that created the log entry.
logLevel - The severity level of the log entry.
message - The log message.
timestamp - The time when the log entry was created.
threadID - The ID of the thread that created the log entry.
threadName - The name of the thread that created the log entry.
throwable - An optional exception associated with the log entry.
properties - A map of additional properties associated with the log entry.

public record LogEntry(@NotNull String loggerName, @NotNull LogLevel logLevel, @NotNull String message, long timestamp, long threadID, @NotNull String threadName, @Nullable Throwable throwable, @NotNull Map<String,Object> properties) extends Record
Represents an individual log entry with details such as log level, message, timestamp, thread ID, thread name, and an optional throwable.
  • Constructor Details

    • LogEntry

      public LogEntry(@NotNull @NotNull String loggerName, @NotNull @NotNull LogLevel logLevel, @NotNull @NotNull String message, long timestamp, long threadID, @NotNull @NotNull String threadName, @Nullable @Nullable Throwable throwable, @NotNull @NotNull Map<String,Object> properties)
      Creates an instance of a LogEntry record class.
      Parameters:
      loggerName - the value for the loggerName record component
      logLevel - the value for the logLevel record component
      message - the value for the message record component
      timestamp - the value for the timestamp record component
      threadID - the value for the threadID record component
      threadName - the value for the threadName record component
      throwable - the value for the throwable record component
      properties - the value for the properties record component
  • Method Details

    • addProperty

      public LogEntry addProperty(@NotNull @NotNull String key, @NotNull @NotNull Object value)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • loggerName

      @NotNull public @NotNull String loggerName()
      Returns the value of the loggerName record component.
      Returns:
      the value of the loggerName record component
    • logLevel

      @NotNull public @NotNull LogLevel logLevel()
      Returns the value of the logLevel record component.
      Returns:
      the value of the logLevel record component
    • message

      @NotNull public @NotNull String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • timestamp

      public long timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • threadID

      public long threadID()
      Returns the value of the threadID record component.
      Returns:
      the value of the threadID record component
    • threadName

      @NotNull public @NotNull String threadName()
      Returns the value of the threadName record component.
      Returns:
      the value of the threadName record component
    • throwable

      @Nullable public @Nullable Throwable throwable()
      Returns the value of the throwable record component.
      Returns:
      the value of the throwable record component
    • properties

      @NotNull public @NotNull Map<String,Object> properties()
      Returns the value of the properties record component.
      Returns:
      the value of the properties record component