Team-OKC-Robotics / FRC-2023

The FRC team #2718 Team OKC Robotics code for the 2023 season
Other
2 stars 0 forks source link

Create custom logging framework #41

Closed jkleiber closed 1 year ago

jkleiber commented 1 year ago

Summary The WPILib logging framework has issues with poor memory management leading to segfaults in unit tests. Additionally, their implementation encourages the use of a singleton log object, which is not a good design pattern for something simple like logging data.

We should make our own system for this. This ticket's objective is to replace the WPILIB logging in our code with a custom logging system.

Work Required

Verification

Fyi @danielbrownmsm

jasonzondor commented 1 year ago

May I suggest using a logger library?: https://github.com/SergiusTheBest/plog

It follows a standard logging message format that's easily parsed.

jkleiber commented 1 year ago

As long as it doesn't have hidden segfaults, it's worth a look 😄

danielbrownmsm commented 1 year ago

How easy would it be to get logs off the robot though? That's the current advantage of the WPILib one, in addition to official support and the fact that we already have it set up.

jkleiber commented 1 year ago

The goal of this would be for it to be equally easy to pull off the robot, if not easier. I need to add filename timestamps to my PR, but other than that I believe it would be the same level of difficulty based on the file format and how plog basically does the same thing WPILib does, but in plaintext instead of a binary format

I would argue that we don't have as much control over the WPILib implementation, which is more risky. At least with this we can freeze the version, customize the tool, and pull updates when needed. It also doesn't break CI which is a plus. The official support from WPILib on the datalogging issue is that they might not work on it anytime soon

jasonzondor commented 1 year ago

We could do something like syslog-ng... https://github.com/syslog-ng/syslog-ng basically, syslog-ng running on the rio capturing logs and sending them to a syslog-ng receiver on the driver station.

jkleiber commented 1 year ago

To get logs off the robot, all we really would need is FileZilla. If we want to get really fancy I think we could make a Python FTP script that pulls logs automatically

jasonzondor commented 1 year ago

Windows has a built-in ftp client in the command prompt. Super easy to use for simple transfers.

jkleiber commented 1 year ago

We will stick with the WPILib logging for now. If this decision is revisited, it should be in a new ticket