From c8a4d7b71d0fb75506511f2b8d44d932653e3523 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Tue, 7 May 2019 09:00:26 +0300
Subject: [PATCH] Implemented #1

---
 common/cpp/src/configuration.cpp | 26 +++++++++++++++++++++-----
 vision/src/main.cpp              |  2 --
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/common/cpp/src/configuration.cpp b/common/cpp/src/configuration.cpp
index d42d487e9..a2674dcb0 100644
--- a/common/cpp/src/configuration.cpp
+++ b/common/cpp/src/configuration.cpp
@@ -129,20 +129,36 @@ static bool mergeConfig(const string &path) {
  */
 static bool findConfiguration(const string &file, const vector<string> &paths,
 		const std::string &app) {
+	bool f = false;
 	bool found = false;
 	
-	found |= mergeConfig(FTL_GLOBAL_CONFIG_ROOT "/config.json");
-	found |= mergeConfig(FTL_LOCAL_CONFIG_ROOT "/config.json");
-	found |= mergeConfig("./config.json");
+	f = mergeConfig(FTL_GLOBAL_CONFIG_ROOT "/config.json");
+	found |= f;
+	if (f) LOG(INFO) << "Loaded config: " << FTL_GLOBAL_CONFIG_ROOT "/config.json";
+	f = mergeConfig(FTL_LOCAL_CONFIG_ROOT "/config.json");
+	found |= f;
+	if (f) LOG(INFO) << "Loaded config: " << FTL_LOCAL_CONFIG_ROOT "/config.json";
+	f = mergeConfig("./config.json");
+	found |= f;
+	if (f) LOG(INFO) << "Loaded config: " << "./config.json";
 	
 	for (auto p : paths) {
 		if (is_directory(p)) {
-			found |= mergeConfig(p+"/config.json");
+			f = mergeConfig(p+"/config.json");
+			found |= f;
+			if (f) LOG(INFO) << "Loaded config: " << p << "/config.json";
 		}
 	}
 	
 	if (file != "") {
-		found |= mergeConfig(file);
+		f = mergeConfig(file);
+		found |= f;
+
+		if (!f) {
+			LOG(ERROR) << "Specific config file (" << file << ") was not found";
+		} else {
+			LOG(INFO) << "Loaded config: " << file;
+		}
 	}
 
 	if (found) {
diff --git a/vision/src/main.cpp b/vision/src/main.cpp
index 0665b797c..70edfd239 100644
--- a/vision/src/main.cpp
+++ b/vision/src/main.cpp
@@ -144,9 +144,7 @@ static void run(const string &file) {
 			//sync->get(ftl::LEFT, l);
 			//sync->get(ftl::RIGHT, r);
 
-			LOG(INFO) << "PRE DISPARITY";
 		    disparity->compute(l, r, disp);
-			LOG(INFO) << "POST DISPARITY";
 
 			unique_lock<mutex> lk(m);
 			jobs++;
-- 
GitLab