Class ClassSpecificLogger<T>

java.lang.Object
edu.wpi.first.epilogue.logging.ClassSpecificLogger<T>
Type Parameters:
T - the type of data supported by the logger

public abstract class ClassSpecificLogger<T> extends Object
Base class for class-specific generated loggers. Loggers are generated at compile time by the Epilogue annotation processor and are used at runtime for zero-overhead data logging. Users may also declare custom loggers, annotated with @CustomLoggerFor, for Epilogue to pull in during compile time to use for logging third party types.
  • Constructor Details

    • ClassSpecificLogger

      protected ClassSpecificLogger(Class<T> clazz)
      Instantiates the logger.
      Parameters:
      clazz - the Java class of objects that can be logged
  • Method Details

    • update

      protected abstract void update(EpilogueBackend backend, T object)
      Updates an object's fields in a data log.
      Parameters:
      backend - the backend to update
      object - the object to update in the log
    • tryUpdate

      public final void tryUpdate(EpilogueBackend backend, T object, ErrorHandler errorHandler)
      Attempts to update the data log. Will do nothing if the logger is disabled.
      Parameters:
      backend - the backend to log data to
      object - the data object to log
      errorHandler - the handler to use if logging raised an exception
    • isDisabled

      public final boolean isDisabled()
      Checks if this logger has been disabled.
      Returns:
      true if this logger has been disabled by disable(), false if not
    • disable

      public final void disable()
      Disables this logger. Any log calls made while disabled will be ignored.
    • reenable

      public final void reenable()
      Reenables this logger after being disabled. Has no effect if the logger is already enabled.
    • getLoggedType

      public final Class<T> getLoggedType()
      Gets the type of the data this logger accepts.
      Returns:
      the logged data type
    • logSendable

      protected void logSendable(EpilogueBackend backend, Sendable sendable)
      Logs a sendable type.
      Parameters:
      backend - the backend to log data into
      sendable - the sendable object to log