Commit 5199918d authored by Ramon Nou's avatar Ramon Nou
Browse files

adding fmt10 support

parent a286bfeb
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ project(
  VERSION 0.3.6
  LANGUAGES C CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Set default build type and also populate a list of available options
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@@ -214,7 +216,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building {fmt}")
FetchContent_Declare(
  fmt
  GIT_REPOSITORY https://github.com/fmtlib/fmt
  GIT_TAG d141cdbeb0fb422a3fb7173b285fd38e0d1772dc # v8.0.1
  GIT_TAG 10.2.1
  GIT_SHALLOW ON
  GIT_PROGRESS ON
)
@@ -227,7 +229,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building spdlog")
FetchContent_Declare(
  spdlog
  GIT_REPOSITORY https://github.com/gabime/spdlog
  GIT_TAG eb3220622e73a4889eee355ffa37972b3cac3df5 # v1.9.2
  GIT_TAG v1.14.0
  GIT_SHALLOW ON
  GIT_PROGRESS ON
)
+7 −1
Original line number Diff line number Diff line
@@ -29,9 +29,15 @@
#include <vector>
#include <string_view>
#include <optional>
#include <filesystem>
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <fmt/os.h>
#include <fmt/std.h>
#include "cargo/error.hpp"



namespace cargo {

class dataset;
@@ -44,7 +50,7 @@ struct fmt::formatter<cargo::dataset> : formatter<std::string_view> {
    template <typename FormatContext>
    auto
    format(const cargo::dataset& d, FormatContext& ctx) const {
        const auto str = fmt::format("{{path: {}}}", std::quoted(d.path()));
        const auto str = fmt::format("{{path: {:?}}}", d.path());
        return formatter<std::string_view>::format(str, ctx);
    }
};
+4 −1
Original line number Diff line number Diff line
@@ -25,9 +25,12 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP

#include <filesystem>
#include <spdlog/logger.h>
#include <fmt/format.h>
#include <fmt/std.h>
#include <fmt/ostream.h>
#include <filesystem>

#include <optional>
#include <sstream>

+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
#include <filesystem>
#include <string>
#include <system_error>
#include <fmt/format.h>


#include <logger/logger.hpp>
#include "signal_listener.hpp"
+12 −8
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@
#include <string_view>
#include <atomic>
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <fmt/os.h>
#include <fmt/std.h>
#include <iomanip>

namespace network {

@@ -114,22 +118,22 @@ struct fmt::formatter<network::rpc_info> {
        }

        if(it != end && *it != '}') {
            ctx.on_error("invalid format");
            format_error("invalid format");
        }

        return it;
    }

    template <typename FormatContext>
    constexpr auto
    auto
    format(const network::rpc_info& rpc, FormatContext& ctx) const {
        format_to(ctx.out(), "{}{} id: {} name: {} ", m_outbound ? "<=" : "=>",
        format_to(ctx.out(), "{}{} id: {} name: {:?} ", m_outbound ? "<=" : "=>",
                  rpc.pid() ? fmt::format(" pid: {}", *rpc.pid()) : "",
                  rpc.id(), std::quoted(rpc.name()));
        return m_outbound ? format_to(ctx.out(), "to: {}",
                                      std::quoted(rpc.address()))
                          : format_to(ctx.out(), "from: {}",
                                      std::quoted(rpc.address()));
                  rpc.id(), (rpc.name()));
        return m_outbound ? format_to(ctx.out(), "to: {:?}",
                                      (rpc.address()))
                          : format_to(ctx.out(), "from: {:?}",
                                      (rpc.address())); 
    }
};

Loading