Package io.github.oblarg.oblog
Interface Loggable
-
public interface Loggable
Marks a class as loggable. Loggable classes will define the tabs/layouts/sublayouts of your shuffleboard. Fields or getters of Loggable classes that you wish to log should be annotated withLog
or one of its widget-specific sub-annotations. Any children (i.e. fields) of a Loggable class that are themselves Loggable will be recursively given a layout within the tab/layout defined by the parent.Note that Loggable classes that are not reachable from the root container passed to
Logger.configureLogging(Object)
through a sequence of Loggable ancestors will not be logged, as the Logger will not be able to see them.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
addCustomLogging(ShuffleboardContainerWrapper container)
Override to add custom logging not supported through the standardLog
options.default int[]
configureLayoutPosition()
Set the position of this layout of this object in shuffleboard if it is located directly within a tab.default java.util.Map<java.lang.String,java.lang.Object>
configureLayoutProperties()
Set the properties of the layout of the object in Shuffleboard if it is not a root (roots define their own tabs, instead).default int[]
configureLayoutSize()
Set the size of the layout of this object in shuffleboard if it is located directly within a tab.default edu.wpi.first.wpilibj.shuffleboard.LayoutType
configureLayoutType()
Set the type of layout of the object in Shuffleboard if it is not a root (roots define their own tabs, instead).default java.lang.String
configureLogName()
Set the name the object will take in Shuffleboard.default boolean
skipLayout()
Whether this Loggable should not define its own layout.
-
-
-
Method Detail
-
configureLogName
default java.lang.String configureLogName()
Set the name the object will take in Shuffleboard. Must be overridden to disambiguate between multiple fields of the same type, or else an error will be thrown.- Returns:
- The name the object will take when logged on Shuffleboard. Defaults to the class name.
-
configureLayoutType
default edu.wpi.first.wpilibj.shuffleboard.LayoutType configureLayoutType()
Set the type of layout of the object in Shuffleboard if it is not a root (roots define their own tabs, instead).- Returns:
- the type of layout of the object in shuffleboard. Defaults to list.
-
configureLayoutSize
default int[] configureLayoutSize()
Set the size of the layout of this object in shuffleboard if it is located directly within a tab.- Returns:
- A two-element array specifying the width and height of the layout (e.g. {4,3} would be 4-wide, 3-high).
-
configureLayoutPosition
default int[] configureLayoutPosition()
Set the position of this layout of this object in shuffleboard if it is located directly within a tab.- Returns:
- A two-element array specifying the column and row index of the layout (e.g. {4,3} would be column 4, row 3).
-
configureLayoutProperties
default java.util.Map<java.lang.String,java.lang.Object> configureLayoutProperties()
Set the properties of the layout of the object in Shuffleboard if it is not a root (roots define their own tabs, instead).- Returns:
- A map of property keys and values. Defaults to null (will yield default Shuffleboard properties).
-
addCustomLogging
default void addCustomLogging(ShuffleboardContainerWrapper container)
Override to add custom logging not supported through the standardLog
options. Called by the logger on each io.github.oblarg.oblog.Loggable after the handling of annotated fields and methods.- Parameters:
container
- The ShuffleboardContainer corresponding to this object, in which widgets can be placed.
-
skipLayout
default boolean skipLayout()
Whether this Loggable should not define its own layout. Useful for Loggables that hold other Loggables, but do not contain any logged fields or methods, or for when you want fields of a Loggable child to appear directly in the layout/tab of its parent.- Returns:
- whether to skip this Loggable's layout.
-
-