Class Logger


  • public class Logger
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Logger()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void configureConfig​(java.lang.Object rootContainer)
      Configure shuffleboard config for the robot.
      static void configureLogging​(java.lang.Object rootContainer)
      Configure shuffleboard logging for the robot.
      static void configureLoggingAndConfig​(java.lang.Object rootContainer, boolean separate)
      Configure shuffleboard logging and config for the robot.
      static void configureLoggingNTOnly​(java.lang.Object rootContainer, java.lang.String rootName)
      Configures logging to send values over NetworkTables, but not to add widgets to Shuffleboard .
      static void registerEntry​(edu.wpi.first.networktables.GenericEntry entry, java.util.function.Supplier<java.lang.Object> supplier)
      Registers a new entry.
      static void setCycleWarningsEnabled​(boolean enabled)
      Enables or disables warnings for cyclic references of loggables.
      static void updateEntries()
      Updates all entries.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Logger

        public Logger()
    • Method Detail

      • setCycleWarningsEnabled

        public static void setCycleWarningsEnabled​(boolean enabled)
        Enables or disables warnings for cyclic references of loggables. Kotlin users will likely want to disable these, as kotlin singletons compile to cycles in the bytecode which cannot be explicitly broken with Log.Exclude.
        Parameters:
        enabled - Whether to print a warning on configuration when cyclic references of loggables are detected.
      • configureLogging

        public static void configureLogging​(java.lang.Object rootContainer)
        Configure shuffleboard logging for the robot. Should be called after all loggable objects have been instantiated, e.g. at the end of robotInit. Tabs for logging will be separate from tabs for config.
        Parameters:
        rootContainer - The root of the tree of loggable objects - for most teams, this is Robot.java. To send an instance of Robot.java to this method from robotInit, call "configureLogging(this)" Loggable fields of this object will have their own shuffleboard tabs.
      • configureConfig

        public static void configureConfig​(java.lang.Object rootContainer)
        Configure shuffleboard config for the robot. Should be called after all loggable objects have been instantiated, e.g. at the end of robotInit. Tabs for config will be separate from tabs for logging.
        Parameters:
        rootContainer - The root of the tree of loggable objects - for most teams, this is Robot.java. To send an instance of Robot.java to this method from robotInit, call "configureConfig(this)" Loggable fields of this object will have their own shuffleboard tabs.
      • configureLoggingAndConfig

        public static void configureLoggingAndConfig​(java.lang.Object rootContainer,
                                                     boolean separate)
        Configure shuffleboard logging and config for the robot. Should be called after all loggable objects have beeen instantiated, e.g. at the end of robotInit. Config and logging can either be given separate tabs, or all widgets can be placed in the same tabs.
        Parameters:
        rootContainer - The root of the tree of loggable objects - for most teams, this is Robot.java. To send an instance of Robot.java to this method from robotInit, call "configureLoggingAndConfig(this)" Loggable fields of this object will have their own shuffleboard tabs.
        separate - Whether to generate separate tabs for config and logging. If true, log widgets will be placed in tabs labeled "Log", and config widgets will be placed in tabs labeled "Config".
      • configureLoggingNTOnly

        public static void configureLoggingNTOnly​(java.lang.Object rootContainer,
                                                  java.lang.String rootName)
        Configures logging to send values over NetworkTables, but not to add widgets to Shuffleboard . Use is the same as configureLogging(Object).
        Parameters:
        rootContainer - The root of the tree of loggable objects - for most teams, this is Robot.java. To send an instance of Robot.java to this method from robotInit, call "configureLogging(this)"
        rootName - Name of the root NetworkTable. io.github.oblarg.oblog.Loggable fields of rootContainer will be subtables.
      • updateEntries

        public static void updateEntries()
        Updates all entries. Must be called periodically from the main robot loop.
      • registerEntry

        public static void registerEntry​(edu.wpi.first.networktables.GenericEntry entry,
                                         java.util.function.Supplier<java.lang.Object> supplier)
        Registers a new entry. To be called during initial logging configuration for any value that will change during runtime. Mostly for internal use, but can be used by advanced users in Loggable.addCustomLogging(ShuffleboardContainerWrapper).
        Parameters:
        entry - The entry to be updated.
        supplier - The supplier with which to update the entry.