diff --git a/app/main.cpp b/app/main.cpp index 74e6205d..099eb534 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -325,8 +325,7 @@ int main(int argc, char* argv[]) if(strcmp(argv[i], "-debug") == 0 || strcmp(argv[i], "--debug") == 0) { - ULogger::setPrintWhere(true); - ULogger::setLevel(ULogger::kDebug); + customParameters.insert(find_object::Settings::kGeneral_debug(), true); continue; } if(strcmp(argv[i], "-log-time") == 0 || diff --git a/include/find_object/Settings.h b/include/find_object/Settings.h index fe00c9ec..dab1f9b5 100644 --- a/include/find_object/Settings.h +++ b/include/find_object/Settings.h @@ -284,6 +284,7 @@ class FINDOBJECT_EXP Settings PARAMETER(General, sendNoObjDetectedEvents, bool, true, "When there are no objects detected, send an empty object detection event."); PARAMETER(General, autoPauseOnDetection, bool, false, "Auto pause the camera when an object is detected."); PARAMETER(General, autoScreenshotPath, QString, "", "Path to a directory to save screenshot of the current camera view when there is a detection."); + PARAMETER(General, debug, bool, false, "Show debug logs on terminal."); PARAMETER(Homography, homographyComputed, bool, true, "Compute homography? On ROS, this is required to publish objects detected."); PARAMETER(Homography, method, QString, "1:LMEDS;RANSAC;RHO", "Type of the robust estimation algorithm: least-median algorithm or RANSAC algorithm."); diff --git a/src/FindObject.cpp b/src/FindObject.cpp index 4bab85da..7ebdac92 100644 --- a/src/FindObject.cpp +++ b/src/FindObject.cpp @@ -54,6 +54,17 @@ FindObject::FindObject(bool keepImagesInRAM, QObject * parent) : { qRegisterMetaType("find_object::DetectionInfo"); UASSERT(detector_ != 0 && extractor_ != 0); + + if(Settings::getGeneral_debug()) + { + ULogger::setPrintWhere(true); + ULogger::setLevel(ULogger::kDebug); + } + else + { + ULogger::setPrintWhere(false); + ULogger::setLevel(ULogger::kInfo); + } } FindObject::~FindObject() { diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 5271a543..f7efc062 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1647,6 +1647,17 @@ void MainWindow::notifyParametersChanged(const QStringList & paramChanged) ui_->actionCamera_from_video_file->setChecked(!Settings::getCamera_5mediaPath().isEmpty() && !UDirectory::exists(Settings::getCamera_5mediaPath().toStdString()) && !Settings::getCamera_6useTcpCamera()); ui_->actionCamera_from_directory_of_images->setChecked(!Settings::getCamera_5mediaPath().isEmpty() && UDirectory::exists(Settings::getCamera_5mediaPath().toStdString()) && !Settings::getCamera_6useTcpCamera()); ui_->actionCamera_from_TCP_IP->setChecked(Settings::getCamera_6useTcpCamera()); + + if(Settings::getGeneral_debug()) + { + ULogger::setPrintWhere(true); + ULogger::setLevel(ULogger::kDebug); + } + else + { + ULogger::setPrintWhere(false); + ULogger::setLevel(ULogger::kInfo); + } } } // namespace find_object