void InitializeEasyLogging(int argc, char* argv[]) { std::string app_dir = QCoreApplication::applicationDirPath().toStdString(); std::string log_file = app_dir + "/MHUD2.log"; std::string conf_file = app_dir + "/MHUD2.log.conf"; START_EASYLOGGINGPP(argc, argv); el::Configurations logger_conf(conf_file); logger_conf.setGlobally(el::ConfigurationType::Filename, log_file); logger_conf.setGlobally(el::ConfigurationType::ToFile, "true"); el::Loggers::setDefaultConfigurations(logger_conf, true); }
void InitializeEasyLogging(int argc, char* argv[]) { START_EASYLOGGINGPP(argc, argv); // EasyLogging++ does not support unicode file paths, we workaround this by changing the working directory std::wstring app_dir = QCoreApplication::applicationDirPath().toStdWString(); SetCurrentDirectory(app_dir.c_str()); // Initialize the file logging module std::string log_file = "MHUD2.log"; std::string conf_file = "MHUD2.log.conf"; el::Configurations logger_conf(conf_file); logger_conf.setGlobally(el::ConfigurationType::Filename, log_file); logger_conf.setGlobally(el::ConfigurationType::ToFile, "true"); el::Loggers::setDefaultConfigurations(logger_conf, true); }
bool InitializeEasyLogging() { char dll_path[MAX_PATH] = { '\0' }; if (GetModuleFileName(dll_handle, dll_path, MAX_PATH) == 0) return false; PathRemoveFileSpec(dll_path); std::string mhud2_dir = std::string(dll_path); std::string conf_file = mhud2_dir + "/MHUD2.log.conf"; std::string log_file = mhud2_dir + "/MHUD2.log"; el::Configurations logger_conf(conf_file); logger_conf.setGlobally(el::ConfigurationType::Format, "[%datetime{%Y-%M-%d %h:%m:%s %F}] " "[TID: %thread] [%level] [HookDLL] %msg"); logger_conf.setGlobally(el::ConfigurationType::Filename, log_file); logger_conf.setGlobally(el::ConfigurationType::ToFile, "true"); el::Loggers::setDefaultConfigurations(logger_conf, true); }