diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 46c1a0368..94eea7e67 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,6 +108,7 @@ target_link_libraries(zms PRIVATE zm-core-interface zm + fmt::fmt ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS} ${CMAKE_DL_LIBS}) diff --git a/src/zms.cpp b/src/zms.cpp index 01df67fc7..b462e1352 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -24,6 +24,7 @@ #include "zm_monitorstream.h" #include "zm_eventstream.h" #include "zm_fifo.h" +#include #include bool ValidateAccess(User *user, int mon_id) { @@ -81,8 +82,7 @@ int main(int argc, const char *argv[], char **envp) { nph = true; } - char log_id_string[32] = "zms"; - logInit(log_id_string); + logInit("zms"); zmLoadStaticConfig(); zmDbConnect(); zmLoadDBConfig(); @@ -181,12 +181,13 @@ int main(int argc, const char *argv[], char **envp) { } // end if possible parameter names } // end foreach parm + std::string logId; if ( monitor_id ) { - snprintf(log_id_string, sizeof(log_id_string), "zms_m%d", monitor_id); + logId = fmt::format("zms_m{}", monitor_id); } else { - snprintf(log_id_string, sizeof(log_id_string), "zms_e%" PRIu64, event_id); + logId = fmt::format("zms_e{}", event_id); } - logInit(log_id_string); + logInit(logId.c_str()); if ( config.opt_use_auth ) { User *user = nullptr;