mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
refactor: use fmt (#2758)
* deps: use fmt (8.1.1 tag) to build log strings Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
This commit is contained in:
@@ -2,6 +2,10 @@ project(trutils)
|
||||
|
||||
add_compile_options(${CXX_WARNING_FLAGS})
|
||||
|
||||
add_definitions(
|
||||
${LIBFMT_DEFINITIONS}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
@@ -9,6 +13,7 @@ include_directories(
|
||||
SYSTEM
|
||||
${EVENT2_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${LIBFMT_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
foreach(P create edit remote show)
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include <event2/buffer.h>
|
||||
#include <event2/util.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <fmt/core.h>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/crypto-utils.h>
|
||||
@@ -2000,7 +2002,7 @@ static int processResponse(char const* rpcurl, std::string_view response)
|
||||
|
||||
if (!tr_variantFromBuf(&top, TR_VARIANT_PARSE_JSON | TR_VARIANT_PARSE_INPLACE, response))
|
||||
{
|
||||
tr_logAddNamedWarn(MyName, "Unable to parse response \"%" TR_PRIsv "\"", TR_PRIsv_ARG(response));
|
||||
tr_logAddNamedWarn(MyName, fmt::format("Unable to parse response '{}'", response));
|
||||
status |= EXIT_FAILURE;
|
||||
}
|
||||
else
|
||||
@@ -2172,7 +2174,7 @@ static int flush(char const* rpcurl, tr_variant** benc)
|
||||
auto const res = curl_easy_perform(curl);
|
||||
if (res != CURLE_OK)
|
||||
{
|
||||
tr_logAddNamedWarn(MyName, " (%s) %s", rpcurl_http.c_str(), curl_easy_strerror(res));
|
||||
tr_logAddNamedWarn(MyName, fmt::format(" ({}) {}", rpcurl_http, curl_easy_strerror(res)));
|
||||
status |= EXIT_FAILURE;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user