You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/docs/software/telemetry/robot-telemetry-with-annotations.rst
+5-8Lines changed: 5 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Customizing your logging setup
60
60
61
61
The default logging behavior is to log *every* non-static field (public or private) and public method in a class annotated with ``@Logged``, where the associated log entries will use the name of the element. For example, a field declared as ``private double m_someValue`` will appear in logs under the entry ``"m_someValue"``, and a method declared as ``public double getSomeValue()`` will appear under the entry ``"getSomeValue"``.
62
62
63
-
You can change what gets logged and what doesn't by configuring the class-level ``@Logged`` annotation with ``strategy = OPT_IN``. This will tell the annotation processor to *only* log fields and methods that you place a ``@Logged`` annotation on, rather than the default behavior of logging everything that doesn't have a ``@NotLogged`` annotation.
63
+
If you desire to only log certain fields or methods within a class, you can remove the ```@Logged``` annotation from the class itself and place it on individual fields/methods within the class. This allows you to opt-in on logging within a class instead of logging every value.
64
64
65
65
The names of log entries can be changed using the ``name`` configuration option on fields and methods (on a class-level annotation, it changes the name of the autogenerated logger class for avoiding name conflicts and does not change the log names of any instance of that class). For example, a ``private double m_someValue`` field with an ``@Logged(name = "Motor Temperature")`` will appear in logs as ``"Motor Temperature"`` instead of the default ``"m_someValue"`` that would be used.
66
66
@@ -73,8 +73,6 @@ The names of log entries can be changed using the ``name`` configuration option
73
73
- Sets a specific name to use for the annotated element. If placed on a class, this controls the name of the generated logger class for avoiding name conflicts.
74
74
* - Importance
75
75
- Sets the specific importance level for the annotated element, which can be used by the runtime ``minimumImportance`` configuration to control what data to log. If placed on a class, this sets the *default* importance level for all contained elements, which can be overridden on an element-by-element basis. Defaults to ``DEBUG``.
76
-
* - Strategy (class only)
77
-
- Sets the opt-in/opt-out strategy to use for logging elements in the annotated class. Defaults to opt-out, which means every loggable element in the class will be logged unless opted out using the ``@NotLogged`` annotation. Setting this to opt-in gives finer control over what gets logged, but takes more work to set up by manually annotating all the opted-in elements. Setting this option on a field or method has no effect.
78
76
* - Logging Period
79
77
- Sets the amount of time between logging calls.
80
78
* - Logging Period Offset
@@ -164,12 +162,11 @@ The names of log entries can be changed using the ``name`` configuration option
164
162
}
165
163
}
166
164
167
-
@Logged(strategy = OPT_IN)
168
165
class Arm {
169
166
@Logged(name = "At Low Stop", importance = DEBUG)
170
167
public final Trigger atLowStop = new Trigger(...);
171
168
172
-
@Logged(name = "At High Stop", importance = DEBUG)
169
+
@Logged // defaults to an importance of DEBUG and the name as "atHighStop"
173
170
public final Trigger atHighStop = new Trigger(...);
174
171
175
172
@NotLogged // Redundant because the class strategy is opt-in
@@ -180,7 +177,7 @@ The names of log entries can be changed using the ``name`` configuration option
180
177
// ...
181
178
}
182
179
183
-
@Logged(name = "Speed", importance = CRITICAL)
180
+
@Logged
184
181
public Measure<Velocity<Angle>> getSpeed() {
185
182
// ...
186
183
}
@@ -191,9 +188,9 @@ The names of log entries can be changed using the ``name`` configuration option
0 commit comments