Package com.marswars.logging
Class MwLog
java.lang.Object
com.marswars.logging.MwLog
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 Summary
Modifier and TypeMethodDescriptionstatic voidIdempotent.static booleanisReplay()True when running a log replay (AKIT_LOG_PATH env var is set).static voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic <E extends Enum<E>>
voidstatic voidstatic voidstatic <T extends StructSerializable>
voidLogs any single WPI struct (Pose2d, Pose3d, ChassisSpeeds, Rotation2d, …).static <T extends StructSerializable>
voidLogs any WPI struct array (SwerveModuleState[], SwerveModulePosition[], Pose2d[], …).static voidperiodic()Call once at the top of each control loop.static voidStarts a named timer.static voidRecords elapsed seconds since time(key) was called.static doubleDeterministic loop timestamp in seconds (sourced from the log during replay).static voidtunable(String key, double defaultValue, DoubleConsumer onChange) Registers a live-tunable double backed by a NetworkTables entry under /Tuning/.
-
Method Details
-
init
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
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
Starts a named timer. Call timeEnd(key) to record elapsed seconds. -
timeEnd
Records elapsed seconds since time(key) was called. -
log
-
log
-
log
-
log
-
log
-
log
-
log
-
log
-
log
-
log
Logs any single WPI struct (Pose2d, Pose3d, ChassisSpeeds, Rotation2d, …). -
log
Logs any WPI struct array (SwerveModuleState[], SwerveModulePosition[], Pose2d[], …).
-