Class HighLevelLogger

java.lang.Object
org.chsrobotics.lib.telemetry.HighLevelLogger
All Implemented Interfaces:
IntrinsicLoggable

public class HighLevelLogger extends Object implements IntrinsicLoggable
Convenience wrapper class for telemetry/ logging with built-in logging for robot-agnostic data like environment metadata and scheduled commands.

For the internally included loggers of system status to function, the method updateLogs() needs to be called once per robot loop cycle.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    autoGenerateLogs(edu.wpi.first.util.datalog.DataLog log, String name, String subdirName, boolean publishToNT, boolean recordInLog)
    Auto-generates Loggers for important internal values.
    Returns the singleton instance of the HighLevelLogger.
    edu.wpi.first.util.datalog.DataLog
    Returns the DataLog populated by this, for use in more-granular and robot-specific logging.
    void
    logError(String message)
    Writes an error, using the provided string, to the DriverStation console, and writes it to the log.
    void
    logMessage(String message)
    Logs a String message (warning, state transition, startup information, etc.), and prints it to the standard output (DriverStation console).
    void
    logWarning(String message)
    Writes a warning, using the provided string, to the DriverStation console, and writes it to the log.
    void
    Starts the HighLevelLogger.
    void
    Updates the internally generated Loggers.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.chsrobotics.lib.telemetry.IntrinsicLoggable

    autoGenerateLogs
  • Method Details

    • getInstance

      public static HighLevelLogger getInstance()
      Returns the singleton instance of the HighLevelLogger.
      Returns:
      The HighLevelLogger.
    • startLogging

      public void startLogging()
      Starts the HighLevelLogger.

      Upon startup, the logger attempts to read git commit/branch data from the files in the deploy directory of the RoboRio specified in the source for this class (currently "commit.txt" and "branch.txt").

      These should be updated by the build.gradle of your functional robot code as specified by this documentation from WPI.

    • getLog

      public edu.wpi.first.util.datalog.DataLog getLog()
      Returns the DataLog populated by this, for use in more-granular and robot-specific logging.
      Returns:
      The DataLog.
    • logMessage

      public void logMessage(String message)
      Logs a String message (warning, state transition, startup information, etc.), and prints it to the standard output (DriverStation console).
      Parameters:
      message - The message to log.
    • logWarning

      public void logWarning(String message)
      Writes a warning, using the provided string, to the DriverStation console, and writes it to the log.
      Parameters:
      message - The String message to associate with the warning.
    • logError

      public void logError(String message)
      Writes an error, using the provided string, to the DriverStation console, and writes it to the log.
      Parameters:
      message - The String message to associate with the error.
    • autoGenerateLogs

      public void autoGenerateLogs(edu.wpi.first.util.datalog.DataLog log, String name, String subdirName, boolean publishToNT, boolean recordInLog)
      Description copied from interface: IntrinsicLoggable
      Auto-generates Loggers for important internal values.
      Specified by:
      autoGenerateLogs in interface IntrinsicLoggable
      Parameters:
      log - The DataLog to log values inside of, most likely from HighLevelLogger.getLog() or whatever log is being used program-wide.
      name - The name to associate with this object's logged data.
      subdirName - The string name of the existing or new NetworkTables sub-table to write to.
      publishToNT - Whether this should push logged values to NetworkTables.
      recordInLog - Whether this should store logged values in an on-robot log file.
    • updateLogs

      public void updateLogs()
      Description copied from interface: IntrinsicLoggable
      Updates the internally generated Loggers.
      Specified by:
      updateLogs in interface IntrinsicLoggable