diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 16f66835c..aef3e45fa 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -556,13 +556,13 @@ void Logger::logPrint(bool hex, const char * const filepath, const int line, con } } // end logPrint -void logInit(const char *name, const Logger::Options &options) { +void logInit(const std::string &id, const Logger::Options &options) { if (Logger::smInstance) { delete Logger::smInstance; } Logger::smInstance = new Logger(); - Logger::smInstance->initialise(name, options); + Logger::smInstance->initialise(id, options); } void logTerm() { diff --git a/src/zm_logger.h b/src/zm_logger.h index ee358b206..80b6e7ba7 100644 --- a/src/zm_logger.h +++ b/src/zm_logger.h @@ -137,7 +137,7 @@ private: static void usrHandler(int sig); public: - friend void logInit(const char *name, const Options &options); + friend void logInit(const std::string &id, const Options &options); friend void logTerm(); static Logger *fetch() { @@ -177,7 +177,7 @@ public: void logPrint(bool hex, const char * const filepath, const int line, const int level, const char *fstring, ...); }; -void logInit(const char *name, const Logger::Options &options=Logger::Options()); +void logInit(const std::string &id, const Logger::Options &options=Logger::Options()); void logTerm(); inline const std::string &logId() { return Logger::fetch()->id(); diff --git a/src/zmc.cpp b/src/zmc.cpp index 578841729..fc3fe78a3 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -183,11 +183,11 @@ int main(int argc, char *argv[]) { logId = fmt::format("zmc_m{}", monitor_id); } - logInit(logId.c_str()); + logInit(logId); zmLoadStaticConfig(); zmDbConnect(); zmLoadDBConfig(); - logInit(logId.c_str()); + logInit(logId); hwcaps_detect(); @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) { monitor->Reload(); } logTerm(); - logInit(logId.c_str()); + logInit(logId); zm_reload = false; } // end if zm_reload } // end while ! zm_terminate outer connection loop diff --git a/src/zms.cpp b/src/zms.cpp index b462e1352..9ad8f32c8 100644 --- a/src/zms.cpp +++ b/src/zms.cpp @@ -187,7 +187,7 @@ int main(int argc, const char *argv[], char **envp) { } else { logId = fmt::format("zms_e{}", event_id); } - logInit(logId.c_str()); + logInit(logId); if ( config.opt_use_auth ) { User *user = nullptr;