mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -15,6 +15,7 @@
|
||||
#include <wpi/SafeThread.h>
|
||||
#include <wpi/StringExtras.h>
|
||||
#include <wpi/fs.h>
|
||||
#include <wpi/print.h>
|
||||
#include <wpi/timestamp.h>
|
||||
|
||||
#ifdef __FRC_ROBORIO__
|
||||
@@ -310,7 +311,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());
|
||||
}
|
||||
}
|
||||
@@ -461,7 +462,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());
|
||||
}
|
||||
}
|
||||
@@ -493,7 +494,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() {
|
||||
|
||||
Reference in New Issue
Block a user