ENH: refine log level for cli

Change-Id: I781319ae85bff77f58931689f589b53e0e778389
This commit is contained in:
lane.wei 2023-02-13 15:28:37 +08:00 committed by Lane.Wei
parent 60e408bc59
commit 84eebfc729
1 changed files with 10 additions and 21 deletions

View File

@ -457,6 +457,15 @@ int CLI::run(int argc, char **argv)
return (argc == 0) ? 0 : 1;
#endif // SLIC3R_GUI
}
else {
const ConfigOptionInt *opt_loglevel = m_config.opt<ConfigOptionInt>("debug");
if (opt_loglevel) {
set_logging_level(opt_loglevel->value);
}
else {
set_logging_level(2);
}
}
BOOST_LOG_TRIVIAL(info) << "start_gui="<< start_gui << std::endl;
@ -2328,17 +2337,6 @@ int CLI::run(int argc, char **argv)
bool CLI::setup(int argc, char **argv)
{
{
Slic3r::set_logging_level(1);
const char *loglevel = boost::nowide::getenv("BBL_LOGLEVEL");
if (loglevel != nullptr) {
if (loglevel[0] >= '0' && loglevel[0] <= '9' && loglevel[1] == 0)
set_logging_level(loglevel[0] - '0');
else
boost::nowide::cerr << "Invalid BBL_LOGLEVEL environment variable: " << loglevel << std::endl;
}
}
// Detect the operating system flavor after SLIC3R_LOGLEVEL is set.
detect_platform();
@ -2406,15 +2404,6 @@ bool CLI::setup(int argc, char **argv)
m_transforms.emplace_back(opt_key);
}
#if !BBL_RELEASE_TO_PUBLIC
{
const ConfigOptionInt *opt_loglevel = m_config.opt<ConfigOptionInt>("debug");
if (opt_loglevel != 0) {
set_logging_level(opt_loglevel->value);
}
}
#endif
//FIXME Validating at this stage most likely does not make sense, as the config is not fully initialized yet.
std::string validity = m_config.validate();