Class MwLog

java.lang.Object
com.marswars.logging.MwLog

public final class MwLog extends Object
Logging facade for MW-Lib. Wraps AdvantageKit's Logger with DogLog-compatible call signatures so all log/tunable call sites in both repos are a mechanical DogLog→MwLog find/replace.

Call MwLog.init(BuildConstants.class) once (SubsystemManager does this). All other methods are safe to call before init returns (Logger queues them). Call MwLog.periodic() at the top of each control loop to poll tunables and fire onChange consumers.

  • Method Details

    • init

      public static void init(Object buildConstants)
      Idempotent. Sets up data receivers and calls Logger.start().
    • isReplay

      public static boolean isReplay()
      True when running a log replay (AKIT_LOG_PATH env var is set).
    • timestampSeconds

      public static double timestampSeconds()
      Deterministic loop timestamp in seconds (sourced from the log during replay).
    • periodic

      public static void periodic()
      Call once at the top of each control loop. Polls tunables and fires onChange consumers when a value has changed since last loop.
    • tunable

      public static void tunable(String key, double defaultValue, DoubleConsumer onChange)
      Registers a live-tunable double backed by a NetworkTables entry under /Tuning/. The consumer is fired immediately with defaultValue, then on every subsequent change. Tunable changes are captured in the log and replay identically.
    • time

      public static void time(String key)
      Starts a named timer. Call timeEnd(key) to record elapsed seconds.
    • timeEnd

      public static void timeEnd(String key)
      Records elapsed seconds since time(key) was called.
    • log

      public static void log(String key, double value)
    • log

      public static void log(String key, double value, Unit unit)
    • log

      public static void log(String key, double[] value)
    • log

      public static void log(String key, double[] value, Unit unit)
    • log

      public static void log(String key, boolean value)
    • log

      public static void log(String key, long value)
    • log

      public static void log(String key, String value)
    • log

      public static void log(String key, String[] value)
    • log

      public static <E extends Enum<E>> void log(String key, E value)
    • log

      public static <T extends StructSerializable> void log(String key, T value)
      Logs any single WPI struct (Pose2d, Pose3d, ChassisSpeeds, Rotation2d, …).
    • log

      public static <T extends StructSerializable> void log(String key, T[] value)
      Logs any WPI struct array (SwerveModuleState[], SwerveModulePosition[], Pose2d[], …).