Record Class Logging

java.lang.Object
java.lang.Record
org.mbari.jcommons.util.Logging

public record Logging(System.Logger logger, System.Logger.Level level, Throwable cause) extends Record
  • Constructor Details

    • Logging

      public Logging(System.Logger logger)
    • Logging

      public Logging(String loggerName)
    • Logging

      public Logging(Class<?> clazz)
    • Logging

      public Logging(System.Logger logger, System.Logger.Level level, Throwable cause)
      Creates an instance of a Logging record class.
      Parameters:
      logger - the value for the logger record component
      level - the value for the level record component
      cause - the value for the cause record component
  • Method Details

    • atTrace

      public Logging atTrace()
    • atDebug

      public Logging atDebug()
    • atInfo

      public Logging atInfo()
    • atWarn

      public Logging atWarn()
    • atError

      public Logging atError()
    • withCause

      public Logging withCause(Throwable t)
    • log

      public void log(String msg)
    • log

      public void log(Supplier<String> fn)
    • 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.
    • logger

      public System.Logger logger()
      Returns the value of the logger record component.
      Returns:
      the value of the logger record component
    • level

      public System.Logger.Level level()
      Returns the value of the level record component.
      Returns:
      the value of the level record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component