This replaces custom logging system with spdlog-based oxen logging. This PR mainly replaces the backend logging with the spdlog-based system, but doesn't (yet) convert all the existing LogWarn, etc. to use the new format-based logging.
New logging statements will look like:
llarp::log::warning(cat, "blah: {}", val);
where cat should be set up in each .cpp or cluster of .cpp files, as described in the oxen-logging README
As part of spdlog we get fmt, which gives us nice format strings, where are applied generously in this PR.
This will then allow the type to be printed as a "{}" value in a fmt::format string. This is applied to all our printable types here, and all of the operator<< are removed.
This commit also:
replaces various uses of operator<< to ToString()
replaces various uses of std::stringstream with either fmt::format or plain std::string
Rename some to_string and toString() methods to ToString() for consistency (and to work with fmt)
Replace stringify(...) and make_exception usage with fmt::format (and remove stringify/make_exception from util/str.hpp).
This replaces custom logging system with spdlog-based oxen logging. This PR mainly replaces the backend logging with the spdlog-based system, but doesn't (yet) convert all the existing LogWarn, etc. to use the new format-based logging.
New logging statements will look like:
where
cat
should be set up in each .cpp or cluster of .cpp files, as described in the oxen-logging READMEAs part of spdlog we get fmt, which gives us nice format strings, where are applied generously in this PR.
Making types printable now requires two steps:
add this specialization:
template <> constexpr inline bool llarp::IsToStringFormattable = true;
This will then allow the type to be printed as a "{}" value in a fmt::format string. This is applied to all our printable types here, and all of the
operator<<
are removed.This commit also:
operator<<
to ToString()stringify(...)
andmake_exception
usage with fmt::format (and remove stringify/make_exception from util/str.hpp).