add "logfile" option to log diagnostics to file using boost (#13931)
add some logging options Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -1357,6 +1357,10 @@ int CLI::run(int argc, char **argv)
|
||||
else {
|
||||
set_logging_level(2);
|
||||
}
|
||||
const ConfigOptionString* opt_logfile = m_config.opt<ConfigOptionString>("logfile");
|
||||
if (opt_logfile) {
|
||||
set_logging_file(opt_logfile->value);
|
||||
}
|
||||
|
||||
global_begin_time = (long long)Slic3r::Utils::get_current_time_utc();
|
||||
BOOST_LOG_TRIVIAL(warning) << boost::format("cli mode, Current OrcaSlicer Version %1%")%SoftFever_VERSION;
|
||||
|
||||
@@ -9750,6 +9750,7 @@ void DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filamen
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (optdef->type) {
|
||||
case coStrings:
|
||||
{
|
||||
@@ -10846,6 +10847,12 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
||||
def->cli_params = "level";
|
||||
def->set_default_value(new ConfigOptionInt(1));
|
||||
|
||||
def = this->add("logfile", coInt);
|
||||
def->label = L("Log file");
|
||||
def->tooltip = L("Redirects debug logging to file.\n");
|
||||
def->cli_params = "file";
|
||||
def->set_default_value(new ConfigOptionString());
|
||||
|
||||
def = this->add("enable_timelapse", coBool);
|
||||
def->label = L("Enable timelapse for print");
|
||||
def->tooltip = L("If enabled, this slicing will be considered using timelapse.");
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace boost { namespace filesystem { class directory_entry; }}
|
||||
namespace Slic3r {
|
||||
|
||||
extern void set_logging_level(unsigned int level);
|
||||
extern void set_logging_file(const std::string &file);
|
||||
extern unsigned int level_string_to_boost(std::string level);
|
||||
extern std::string get_string_logging_level(unsigned level);
|
||||
extern unsigned get_logging_level();
|
||||
|
||||
@@ -129,6 +129,11 @@ void set_logging_level(unsigned int level)
|
||||
);
|
||||
}
|
||||
|
||||
void set_logging_file(const std::string &file)
|
||||
{
|
||||
boost::log::add_file_log(file);
|
||||
}
|
||||
|
||||
unsigned int level_string_to_boost(std::string level)
|
||||
{
|
||||
std::map<std::string, int> Control_Param;
|
||||
|
||||
Reference in New Issue
Block a user