Class Logger.LoggerFactory<U>

java.lang.Object
org.chsrobotics.lib.telemetry.Logger.LoggerFactory<U>
Type Parameters:
U - Data type of the loggers to create.
Enclosing class:
Logger<T>

public static class Logger.LoggerFactory<U> extends Object
Factory class to simplify creating many similar logs at once.
  • Constructor Details

    • LoggerFactory

      public LoggerFactory(edu.wpi.first.util.datalog.DataLog log, String subdirName, boolean publishToNT, boolean recordInLog)
      Constructs a LoggerFactory.

      All Loggers constructed with this factory will share these settings.

      Parameters:
      log - The DataLog to log values inside of, most likely from HighLevelLogger.getInstance().getLog() or whatever log is being used program-wide.
      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.
    • LoggerFactory

      public LoggerFactory(String subdirName)
      Constructs a Logger using HighLevelLogger.getLog(), publishing to NT and logging.
      Parameters:
      subdirName - The string name of the existing or new NetworkTables sub-table to write to.
  • Method Details

    • getLogger

      public Logger<U> getLogger(String key)
      Constructs and returns a new logger with the parameters given above.
      Parameters:
      key - A string identifier for the logged field.
      Returns:
      A new Logger.
    • getLogger

      public Logger<U> getLogger(String key, Supplier<U> lambda)
      Constructs and returns a new logger with the parameters given above.
      Parameters:
      key - A string identifier for the logged field.
      lambda - Lambda (of logged type) to use as initial data source.
      Returns:
      A new Logger.