log tweak:

1. deprecate severity_level, use log_severity_level config key
2. remove encrytped bbl debug_network log file
This commit is contained in:
SoftFever 2024-03-17 23:06:42 +08:00
parent 53e45310f3
commit 8d34e22d7f
5 changed files with 30 additions and 7 deletions

View file

@ -2169,7 +2169,7 @@ void GUI_App::init_app_config()
}
#endif // _WIN32
}
set_logging_level(Slic3r::level_string_to_boost(app_config->get("severity_level")));
set_logging_level(Slic3r::level_string_to_boost(app_config->get("log_severity_level")));
}
@ -2297,6 +2297,28 @@ int GUI_App::OnExit()
m_agent = nullptr;
}
// Orca: clean up encrypted bbl network log file if plugin is used
// No point to keep them as they are encrypted and can't be used for debugging
try {
auto log_folder = boost::filesystem::path(data_dir()) / "log";
const std::string filePattern = R"(debug_network_.*\.log\.enc)";
std::regex pattern(filePattern);
if (boost::filesystem::exists(log_folder)) {
std::vector<boost::filesystem::path> network_logs;
for (auto& it : boost::filesystem::directory_iterator(log_folder)) {
auto temp_path = it.path();
if (boost::filesystem::is_regular_file(temp_path) && std::regex_match(temp_path.filename().string(), pattern)) {
network_logs.push_back(temp_path.filename());
}
}
for (auto f : network_logs) {
boost::filesystem::remove(f);
}
}
} catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed to clean up encrypt bbl network log file";
}
return wxApp::OnExit();
}