Package edu.wpi.first.epilogue.logging
Class ClassSpecificLogger<T>
java.lang.Object
edu.wpi.first.epilogue.logging.ClassSpecificLogger<T>
- Type Parameters:
T
- the type of data supported by the logger
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 Summary
ModifierConstructorDescriptionprotected
ClassSpecificLogger
(Class<T> clazz) Instantiates the logger. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
disable()
Disables this logger.Gets the type of the data this logger accepts.final boolean
Checks if this logger has been disabled.protected void
logSendable
(EpilogueBackend backend, Sendable sendable) Logs a sendable type.final void
reenable()
Reenables this logger after being disabled.final void
tryUpdate
(EpilogueBackend backend, T object, ErrorHandler errorHandler) Attempts to update the data log.protected abstract void
update
(EpilogueBackend backend, T object) Updates an object's fields in a data log.
-
Constructor Details
-
ClassSpecificLogger
Instantiates the logger.- Parameters:
clazz
- the Java class of objects that can be logged
-
-
Method Details
-
update
Updates an object's fields in a data log.- Parameters:
backend
- the backend to updateobject
- the object to update in the log
-
tryUpdate
Attempts to update the data log. Will do nothing if the logger isdisabled
.- Parameters:
backend
- the backend to log data toobject
- the data object to logerrorHandler
- the handler to use if logging raised an exception
-
isDisabled
Checks if this logger has been disabled.- Returns:
- true if this logger has been disabled by
disable()
, false if not
-
disable
Disables this logger. Any log calls made while disabled will be ignored. -
reenable
Reenables this logger after being disabled. Has no effect if the logger is already enabled. -
getLoggedType
Gets the type of the data this logger accepts.- Returns:
- the logged data type
-
logSendable
Logs a sendable type.- Parameters:
backend
- the backend to log data intosendable
- the sendable object to log
-