Skip to content

Usage

Once installed, getting started with DogLog is easy. This page will walk you through the first steps to integrating DogLog with your robot project.

Logging

First, import the library from the dev.doglog namespace:

import dev.doglog.DogLog;

And then you can use Doglog.log() to log values like so:

DogLog.log("Arm/Position", motor.getPosition().getValue());

You can include these log statements in your periodic methods, or anywhere else you want to log data.

Configuring

DogLog comes with a safe, reasonable default configuration out of the box, but most users will want to customize it to their needs.

Here’s an example of how to set DogLog to use custom options:

  1. Import the library at the top of Robot.java/RobotContainer.java:

    import dev.doglog.DogLog;
    import dev.doglog.DogLogOptions;
  2. In your Robot/RobotContainer constructor, add the following lines:

    DogLog.setOptions(new DogLogOptions().withCaptureDs(true));

    This configures DogLog to use the default options as a base, and extends them to capture driver station data to the logs.

Logging PDH/PDP data

If you have logging extras enabled, DogLog can automatically log data from the PDP/PDH like battery voltage, device currents, etc.

To enable this, somewhere in your robot code provide a PowerDistribution instance to DogLog.setPdh():

DogLog.setPdh(new PowerDistribution());

Calling DogLog.setPdh(null) will disable PDH logging.

Full example

RobotContainer.java
package frc.robot;
import dev.doglog.DogLog;
import dev.doglog.DogLogOptions;
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.Constants.OperatorConstants;
import frc.robot.commands.ExampleCommand;
import frc.robot.subsystems.ExampleSubsystem;
public class RobotContainer {
private final ExampleSubsystem m_exampleSubsystem = new ExampleSubsystem();
private final CommandXboxController m_driverController = new CommandXboxController(
OperatorConstants.kDriverControllerPort
);
public RobotContainer() {
DogLog.setOptions(new DogLogOptions().withCaptureDs(true));
DogLog.setPdh(new PowerDistribution());
DogLog.log("ExampleLog", "Hello world!");
configureBindings();
}
private void configureBindings() {
// ...
}
}