[wpiutil] Upgrade to fmt 10.2.1, add wpi::print (#6161)

We now use a wrapper (wpi::print) to catch exceptions since we can't patch
std::print() to not throw when we ultimately migrate to it.

fmtlib and std format/print throw the same exceptions and always have. We previously patched fmt::print() to not throw a write failure exception, but we can't do that for std::print(); wpi::print() is the migration plan.
This commit is contained in:
Tyler Veness
2024-05-12 06:25:42 -07:00
committed by GitHub
parent 6c9dcc157e
commit d88c71ffdc
99 changed files with 1374 additions and 1130 deletions

View File

@@ -11,12 +11,12 @@
#include <random>
#include <fmt/chrono.h>
#include <fmt/format.h>
#include <networktables/NetworkTableInstance.h>
#include <wpi/DataLog.h>
#include <wpi/SafeThread.h>
#include <wpi/StringExtras.h>
#include <wpi/fs.h>
#include <wpi/print.h>
#include <wpi/timestamp.h>
#include "frc/DriverStation.h"
@@ -157,7 +157,7 @@ void Thread::Main() {
break;
}
} else {
fmt::print(stderr, "DataLogManager: could not delete {}\n",
wpi::print(stderr, "DataLogManager: could not delete {}\n",
entry.path().string());
}
}
@@ -307,7 +307,7 @@ Instance::Instance(std::string_view dir, std::string_view filename,
if (wpi::starts_with(entry.path().stem().string(), "FRC_TBD_") &&
entry.path().extension() == ".wpilog") {
if (!fs::remove(entry, ec)) {
fmt::print(stderr, "DataLogManager: could not delete {}\n",
wpi::print(stderr, "DataLogManager: could not delete {}\n",
entry.path().string());
}
}
@@ -339,7 +339,7 @@ void DataLogManager::Stop() {
void DataLogManager::Log(std::string_view message) {
GetInstance().owner.GetThread()->m_messageLog.Append(message);
fmt::print("{}\n", message);
wpi::print("{}\n", message);
}
wpi::log::DataLog& DataLogManager::GetLog() {