Browse Source

Put debug output behind ZT_TRACE

Grant Limberg 5 years ago
parent
commit
aab96964b6
1 changed files with 12 additions and 2 deletions
  1. 12 2
      controller/PostgreSQL.cpp

+ 12 - 2
controller/PostgreSQL.cpp

@@ -157,7 +157,6 @@ PostgreSQL::~PostgreSQL()
 		_commitThread[i].join();
 	}
 	_onlineNotificationThread.join();
-	fprintf(stderr, "~PostgreSQL() done\n");
 }
 
 
@@ -739,14 +738,20 @@ void PostgreSQL::_membersWatcher_Redis() {
 		}
 		if (!result.empty()) {
 			for (auto element : result) {
+#ifdef ZT_TRACE
 				fprintf(stdout, "Received notification from: %s\n", element.first.c_str());
+#endif
 				for (auto rec : element.second) {
 					std::string id = rec.first;
 					auto attrs = rec.second;
+#ifdef ZT_TRACE
 					fprintf(stdout, "Record ID: %s\n", id.c_str());
 					fprintf(stdout, "attrs len: %lu\n", attrs.size());
+#endif
 					for (auto a : attrs) {
+#ifdef ZT_TRACE
 						fprintf(stdout, "key: %s\nvalue: %s\n", a.first.c_str(), a.second.c_str());
+#endif
 						try {
 							tmp = json::parse(a.second);
 							json &ov = tmp["old_val"];
@@ -855,15 +860,20 @@ void PostgreSQL::_networksWatcher_Redis() {
 		
 		if (!result.empty()) {
 			for (auto element : result) {
-
+#ifdef ZT_TRACE
 				fprintf(stdout, "Received notification from: %s\n", element.first.c_str());
+#endif
 				for (auto rec : element.second) {
 					std::string id = rec.first;
 					auto attrs = rec.second;
+#ifdef ZT_TRACE
 					fprintf(stdout, "Record ID: %s\n", id.c_str());
 					fprintf(stdout, "attrs len: %lu\n", attrs.size());
+#endif
 					for (auto a : attrs) {
+#ifdef ZT_TRACE
 						fprintf(stdout, "key: %s\nvalue: %s\n", a.first.c_str(), a.second.c_str());
+#endif
 						try {
 							tmp = json::parse(a.second);
 							json &ov = tmp["old_val"];