[wpilib] Add usage reporting for loggers (#7450)

This commit is contained in:
sciencewhiz
2024-11-29 22:13:31 -08:00
committed by GitHub
parent 7d178615fa
commit 0941251375
7 changed files with 55 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
#include <vector>
#include <fmt/chrono.h>
#include <hal/FRCUsageReporting.h>
#include <networktables/NetworkTableInstance.h>
#include <wpi/DataLog.h>
#include <wpi/DataLogBackgroundWriter.h>
@@ -78,6 +79,8 @@ static std::string MakeLogDir(std::string_view dir) {
(s.permissions() & fs::perms::others_write) != fs::perms::none) {
fs::create_directory("/u/logs", ec);
return "/u/logs";
HAL_Report(HALUsageReporting::kResourceType_DataLogManager,
HALUsageReporting::kDataLogLocation_USB);
}
if (RobotBase::GetRuntimeType() == kRoboRIO) {
FRC_ReportWarning(
@@ -85,6 +88,8 @@ static std::string MakeLogDir(std::string_view dir) {
"not recommended! Plug in a FAT32 formatted flash drive!");
}
fs::create_directory("/home/lvuser/logs", ec);
HAL_Report(HALUsageReporting::kResourceType_DataLogManager,
HALUsageReporting::kDataLogLocation_Onboard);
return "/home/lvuser/logs";
#else
std::string logDir = filesystem::GetOperatingDirectory() + "/logs";