fixup: minor log string formatting changes (#2913)

* fixup! fix: sonarcloud (#2865)

fix: log time format string

* fix: formatting changes

* fixup! refactor: remove tr_strvJoin() (#2896)

fix: daemon logging

Co-authored-by: Catadropa <catadropa@users.noreply.github.com>
This commit is contained in:
Charles Kerr 2022-04-13 23:19:18 -05:00 committed by GitHub
parent ec57d10954
commit 5b6f0a52fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -340,8 +340,8 @@ static void printMessage(
std::string_view filename,
int line)
{
auto const out = std::empty(name) ? fmt::format(FMT_STRING("{:s} ({:s}:{:d}"), message, filename, line) :
fmt::format(FMT_STRING("{:s} {:s} ({:s}:{:d}"), name, message, filename, line);
auto const out = std::empty(name) ? fmt::format(FMT_STRING("{:s} ({:s}:{:d})"), message, filename, line) :
fmt::format(FMT_STRING("{:s} {:s} ({:s}:{:d})"), name, message, filename, line);
if (file != TR_BAD_SYS_FILE)
{

View File

@ -243,7 +243,7 @@ char* tr_logGetTimeStr(char* buf, size_t buflen)
auto const [out, len] = fmt::format_to_n(
buf,
buflen - 1,
"{0:%F %H:%M:}{1:%S}\n",
"{0:%F %H:%M:}{1:%S}",
a,
std::chrono::duration_cast<std::chrono::milliseconds>(a.time_since_epoch()));
*out = '\0';

View File

@ -108,7 +108,7 @@ static void natPulse(tr_shared* s, bool do_check)
if (new_status != old_status)
{
tr_logAddInfo(fmt::format(
_("State changed from '{old_state}' to '{state}"),
_("State changed from '{old_state}' to '{state}'"),
fmt::arg("old_state", getNatStateStr(old_status)),
fmt::arg("state", getNatStateStr(new_status))));
}

View File

@ -277,7 +277,7 @@ tr_port_forwarding tr_upnpPulse(tr_upnp* handle, tr_port port, bool isEnabled, b
UPNP_IGD_VALID_CONNECTED)
{
tr_logAddInfo(fmt::format(_("Found Internet Gateway Device '{url}'"), fmt::arg("url", handle->urls.controlURL)));
tr_logAddInfo(fmt::format(_("Local Address is '{address}')"), fmt::arg("address", handle->lanaddr)));
tr_logAddInfo(fmt::format(_("Local Address is '{address}'"), fmt::arg("address", handle->lanaddr)));
handle->state = UpnpState::IDLE;
handle->hasDiscovered = true;
}
@ -341,7 +341,7 @@ tr_port_forwarding tr_upnpPulse(tr_upnp* handle, tr_port port, bool isEnabled, b
handle->isMapped = err_tcp == 0 || err_udp == 0;
}
tr_logAddInfo(fmt::format(
tr_logAddDebug(fmt::format(
_("Port forwarding through '{url}', service '{type}'. (local address: {address}:{port})"),
fmt::arg("url", handle->urls.controlURL),
fmt::arg("type", handle->data.first.servicetype),
@ -350,7 +350,7 @@ tr_port_forwarding tr_upnpPulse(tr_upnp* handle, tr_port port, bool isEnabled, b
if (handle->isMapped)
{
tr_logAddInfo(_("Port forwarding successful!"));
tr_logAddInfo(fmt::format(_("Port {port} is forwarded"), fmt::arg("port", port)));
handle->port = port;
handle->state = UpnpState::IDLE;
}