diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 1e3686301..6bf38dbd6 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -311,14 +311,22 @@ static void printMessage( std::string_view filename, long 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 out = tr_strbuf{}; + + if (std::empty(name)) + { + fmt::format_to(std::back_inserter(out), "{:s} ({:s}:{:d})", message, filename, line); + } + else + { + fmt::format_to(std::back_inserter(out), "{:s} {:s} ({:s}:{:d})", name, message, filename, line); + } if (file != TR_BAD_SYS_FILE) { auto timestr = std::array{}; tr_logGetTimeStr(std::data(timestr), std::size(timestr)); - tr_sys_file_write_line(file, fmt::format(FMT_STRING("[{:s}] {:s} {:s}"), std::data(timestr), levelName(level), out)); + tr_sys_file_write_line(file, fmt::format("[{:s}] {:s} {:s}", std::data(timestr), levelName(level), std::data(out))); } #ifdef HAVE_SYSLOG