Extending the logger
In addition to the configurable logger options, DogLog also allows you to extend the logger class to add your own custom behavior. This is a great way to simplify common logging flows your team has, and reduce duplicated code in your robot projects.
This guide will walk you through the steps to create a custom logger class that allows you to add your own custom behavior.
As an example, we will add in a new log()
method to help log motor values.
Steps
-
Add DogLog to your project if you haven’t already:
-
Create a new file for your extended logger class:
Directorysrc
Directorymain
Directorydeploy/
- …
Directoryjava/
Directoryfrc/
Directoryrobot/
- CustomLogger.java Create this file
- Main.java
- Robot.java
- RobotContainer.java
-
In the newly created file, paste the following code:
-
Replace places where you use
DogLog
withCustomLogger
.