java.lang.Object
java.lang.Record
com.dua3.utility.logging.LogEntry
- All Implemented Interfaces:
Serializable
public record LogEntry(org.slf4j.Logger logger, Instant time, org.slf4j.event.Level level, org.slf4j.Marker marker, String msg, Object[] arguments, Throwable throwable)
extends Record
implements Serializable
Represents a log entry with information about the log message, time, level, logger, and optional marker and throwable.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObject[]Returns the value of theargumentsrecord component.final booleanIndicates whether some other object is "equal to" this one.Formats the message using MessageFormatter.basicArrayFormat.Formats the throwable object by printing its stack trace.final inthashCode()Returns a hash code value for this object.org.slf4j.event.Levellevel()Returns the value of thelevelrecord component.org.slf4j.Loggerlogger()Returns the value of theloggerrecord component.org.slf4j.Markermarker()Returns the value of themarkerrecord component.msg()Returns the value of themsgrecord component.Returns the value of thethrowablerecord component.time()Returns the value of thetimerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
LogEntry
public LogEntry(org.slf4j.Logger logger, Instant time, org.slf4j.event.Level level, org.slf4j.Marker marker, String msg, Object[] arguments, Throwable throwable) Creates an instance of aLogEntryrecord class.- Parameters:
logger- the value for theloggerrecord componenttime- the value for thetimerecord componentlevel- the value for thelevelrecord componentmarker- the value for themarkerrecord componentmsg- the value for themsgrecord componentarguments- the value for theargumentsrecord componentthrowable- the value for thethrowablerecord component
-
-
Method Details
-
formatMessage
Formats the message using MessageFormatter.basicArrayFormat.- Returns:
- the formatted message as a string.
-
formatThrowable
Formats the throwable object by printing its stack trace. If the throwable object is null, it returns an empty string.- Returns:
- the formatted stack trace as a 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. -
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. -
equals
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 withObjects::equals(Object,Object). -
logger
public org.slf4j.Logger logger()Returns the value of theloggerrecord component.- Returns:
- the value of the
loggerrecord component
-
time
Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-
level
public org.slf4j.event.Level level()Returns the value of thelevelrecord component.- Returns:
- the value of the
levelrecord component
-
marker
public org.slf4j.Marker marker()Returns the value of themarkerrecord component.- Returns:
- the value of the
markerrecord component
-
msg
Returns the value of themsgrecord component.- Returns:
- the value of the
msgrecord component
-
arguments
Returns the value of theargumentsrecord component.- Returns:
- the value of the
argumentsrecord component
-
throwable
Returns the value of thethrowablerecord component.- Returns:
- the value of the
throwablerecord component
-