kopia lustrzana https://gitlab.com/tomaszg/geostat
				
				
				
			Adjust debug levels
							rodzic
							
								
									dc91a5c1ed
								
							
						
					
					
						commit
						fb196b1c35
					
				
							
								
								
									
										10
									
								
								ocdb.cpp
								
								
								
								
							
							
						
						
									
										10
									
								
								ocdb.cpp
								
								
								
								
							|  | @ -68,13 +68,13 @@ bool OCdb::init(std::string dump_path) { | |||
| } | ||||
| 
 | ||||
| bool OCdb::init_part(std::string json_file) { | ||||
| 	Debug(1) << "Processing file: " << json_file << '\n'; | ||||
| 	Debug(2) << "Processing file: " << json_file << '\n'; | ||||
| 	 | ||||
| 	std::ifstream file(json_file); | ||||
| 	json j; | ||||
| 	file >> j; | ||||
| 
 | ||||
| 	Debug(3) << "File: " << json_file << " read.\n"; | ||||
| 	Debug(5) << "File: " << json_file << " read.\n"; | ||||
| 	for (auto& el : j.items()) { | ||||
| 		parse_item(el.value()); | ||||
| 	} | ||||
|  | @ -98,14 +98,14 @@ bool OCdb::update(Okapi& oc) { | |||
| bool OCdb::parse_item(json j) { | ||||
| 	if (j.count("object_type") > 0 && j["object_type"] == "geocache") { | ||||
| 		if (j.count("change_type") > 0 && j["change_type"] == "replace") { | ||||
| 			Debug(2) << "Inserting/updating cache " << j["object_key"]["code"].get<std::string>() << ".\n"; | ||||
| 			Debug(5) << "Inserting/updating cache " << j["object_key"]["code"].get<std::string>() << ".\n"; | ||||
| 	// 				if (j["object_key"]["code"] != j["data"]["code"]) {
 | ||||
| 	// 					Debug(1) << "Code change " << j["object_key"]["code"] << " -> " << j["data"]["code"] <<'\n';
 | ||||
| 	// 				}
 | ||||
| 			update_cache(j); | ||||
| 		} | ||||
| 		else if (j.count("change_type") > 0 && j["change_type"] == "delete") { | ||||
| 			Debug(1) << "Deleting cache " << j["object_key"]["code"].get<std::string>() << ".\n"; | ||||
| 			Debug(2) << "Deleting cache " << j["object_key"]["code"].get<std::string>() << ".\n"; | ||||
| 			std::string sql = "DELETE FROM caches WHERE code='" + j["object_key"]["code"].get<std::string>() + "';"; | ||||
| 			request(sql); | ||||
| 		} | ||||
|  | @ -115,7 +115,7 @@ bool OCdb::parse_item(json j) { | |||
| 	} | ||||
| 	else if (j.count("object_type") > 0 && j["object_type"] == "log") { | ||||
| 		if (j["change_type"] == "replace") { | ||||
| 			Debug(2) << "Updating log " << j["object_key"]["uuid"] << ".\n"; | ||||
| 			Debug(3) << "Updating log " << j["object_key"]["uuid"] << ".\n"; | ||||
| 			update_log(j); | ||||
| 		} | ||||
| 		else if (j.count("change_type") > 0 && j["change_type"] == "delete") { | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Tomasz Golinski
						Tomasz Golinski