MCPcopy Create free account
hub / github.com/colmap/colmap / SetLogOptions

Method SetLogOptions

src/colmap/ui/main_window.cc:1614–1674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1612}
1613
1614void MainWindow::SetLogOptions() {
1615 QDialog dialog(this);
1616 dialog.setWindowTitle("Log Options");
1617 dialog.resize(220, 160);
1618
1619 QFormLayout* form_layout = new QFormLayout(&dialog);
1620
1621 // Log target
1622 QComboBox* log_target_box = new QComboBox(&dialog);
1623 log_target_box->addItems({"stderr", "stdout", "file", "stderr_and_file"});
1624 log_target_box->setCurrentText(GetLogTarget().c_str());
1625 log_target_box->setToolTip(
1626 QString("Default output path: system temporary directory "
1627 "(usually: %1)")
1628 .arg(std::filesystem::temp_directory_path().c_str()));
1629 form_layout->addRow("Log target", log_target_box);
1630
1631 // NOTE: glog resolves log file paths during initialization.
1632 // Runtime modification of FLAGS_log_dir does not re-open log files,
1633 // therefore directory changes are not supported here.
1634
1635 // Verbosity
1636 QSpinBox* verbosity_box = new QSpinBox(&dialog);
1637 verbosity_box->setRange(0, 10);
1638 verbosity_box->setValue(FLAGS_v);
1639 form_layout->addRow("Verbosity", verbosity_box);
1640
1641 // Minimum severity
1642 QComboBox* min_severity_box = new QComboBox(&dialog);
1643 min_severity_box->addItems({"INFO", "WARNING", "ERROR", "FATAL"});
1644 min_severity_box->setCurrentIndex(FLAGS_minloglevel);
1645 form_layout->addRow("Minimum severity", min_severity_box);
1646
1647 // Color
1648#if COLMAP_GLOG_HAS_COLOR_SUPPORT
1649 QComboBox* color_box = new QComboBox(&dialog);
1650 color_box->addItems({"Disabled", "Enabled"});
1651 color_box->setCurrentIndex(static_cast<int>(FLAGS_colorlogtostderr));
1652 form_layout->addRow("Colored logging", color_box);
1653#endif
1654
1655 QDialogButtonBox* buttons = new QDialogButtonBox(
1656 QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
1657
1658 connect(buttons, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
1659 connect(buttons, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
1660
1661 form_layout->addRow(buttons);
1662
1663 if (dialog.exec() == QDialog::Accepted) {
1664 ApplyLogOptions(log_target_box->currentText().toStdString(),
1665 verbosity_box->value(),
1666 min_severity_box->currentIndex(),
1667#if COLMAP_GLOG_HAS_COLOR_SUPPORT
1668 color_box->currentIndex()
1669#else
1670 0
1671#endif

Callers

nothing calls this directly

Calls 2

GetLogTargetFunction · 0.85
ApplyLogOptionsFunction · 0.85

Tested by

no test coverage detected