File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/main/java/com/spikes2212/dashboard Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .spikes2212 .dashboard ;
2
2
3
3
import edu .wpi .first .networktables .NetworkTable ;
4
+ import java .time .LocalTime ;
4
5
import edu .wpi .first .wpilibj2 .command .Command ;
5
6
import edu .wpi .first .wpilibj2 .command .InstantCommand ;
6
7
@@ -49,6 +50,15 @@ public <T> void log(T output) {
49
50
putString (key , output == null ? "null" : output .toString ());
50
51
}
51
52
53
+ /**
54
+ * Logs the provided output with a timestamp to the NetworkTables and the SpikesLogger app.
55
+ *
56
+ * @param output the data to be logged
57
+ */
58
+ public <T > void logWithTimestamp (T output ) {
59
+ log (LocalTime .now () + ": " + output );
60
+ }
61
+
52
62
/**
53
63
* Returns a command that logs the provided output to the NetworkTables and the SpikesLogger app.
54
64
*
@@ -58,4 +68,14 @@ public <T> void log(T output) {
58
68
public <T > Command logCommand (T output ) {
59
69
return new InstantCommand (() -> log (output ));
60
70
}
71
+
72
+ /**
73
+ * Returns a command that logs the provided output with a timestamp to the NetworkTables and the SpikesLogger app.
74
+ *
75
+ * @param output the data to be logged
76
+ * @return a command that logs the output
77
+ */
78
+ public <T > Command logWithTimestampCommand (T output ) {
79
+ return new InstantCommand (() -> logWithTimestamp (output ));
80
+ }
61
81
}
You can’t perform that action at this time.
0 commit comments