The answer provided by @3CxEZiVlQ is great. My project is not using a C++20 capable compiler but I was able to modify the code to work with an older compiler. For anybody else stuck with an older C++ compiler this is the code I used:
template <typename T>
struct fmt::formatter<T, std::enable_if_t<std::is_base_of<google::protobuf::Message, T>::value, char>>
: fmt::formatter<string>
{
auto format(const T& message, format_context& ctx) const
{
auto result = fmt::format("{}", message.DebugString());
return fmt::formatter<std::string>::format(result, ctx);
}
};