logger: Pass std::string as ID during logInit
This commit is contained in:
parent
6dc132df27
commit
e18750bb79
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue