Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Use LOG(ERR) where appropriate.

Kishore Nallan0f9c97eaf30c
diff --git a/TODO.md b/TODO.md
index 19eaa86f..4437c18c 100644
--- a/TODO.md
+++ b/TODO.md
@@ -94,7 +94,8 @@
- ~~Deprecate union type punning~~
- ~~Replica server should fail when pointed to "old" master~~
- ~~gzip compress responses~~
-- Have a LOG(ERROR) level
+- ~~Have a LOG(ERROR) level~~
+- Handle SIGTERM which is sent when process is killed
- Parameterize replica's MAX_UPDATES_TO_SEND
- NOT operator support
- > INT32_MAX validation for float field
diff --git a/include/store.h b/include/store.h
index bfc1944a..114b3a20 100644
--- a/include/store.h
+++ b/include/store.h
@@ -109,7 +109,7 @@ public:
return StoreStatus::NOT_FOUND;
}
- LOG(WARNING) << "Error while fetching the key: " << key << " - status is: " << status.ToString();
+ LOG(ERR) << "Error while fetching the key: " << key << " - status is: " << status.ToString();
return StoreStatus::ERROR;
}
diff --git a/src/api.cpp b/src/api.cpp
index 5d5d5f17..e60cf524 100644
--- a/src/api.cpp
+++ b/src/api.cpp
@@ -58,7 +58,7 @@ void post_create_collection(http_req & req, http_res & res) {
try {
req_json = nlohmann::json::parse(req.body);
} catch(const std::exception& e) {
- LOG(WARNING) << "JSON error: " << e.what();
+ LOG(ERR) << "JSON error: " << e.what();
return res.send_400("Bad JSON.");
}
diff --git a/src/collection.cpp b/src/collection.cpp
index b8eb9050..27436382 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -71,7 +71,7 @@ Option<nlohmann::json> Collection::add(const std::string & json_str) {
try {
document = nlohmann::json::parse(json_str);
} catch(const std::exception& e) {
- LOG(WARNING) << "JSON error: " << e.what();
+ LOG(ERR) << "JSON error: " << e.what();
return Option<nlohmann::json>(400, "Bad JSON.");
}
@@ -523,7 +523,7 @@ Option<nlohmann::json> Collection::search(std::string query, const std::vector<s
StoreStatus json_doc_status = store->get(seq_id_key, json_doc_str);
if(json_doc_status != StoreStatus::FOUND) {
- LOG(WARNING) << "Could not locate the JSON document for sequence ID: " << seq_id_key;
+ LOG(ERR) << "Could not locate the JSON document for sequence ID: " << seq_id_key;
continue;
}
@@ -667,7 +667,7 @@ Option<nlohmann::json> Collection::get(const std::string & id) {
StoreStatus doc_status = store->get(get_seq_id_key(seq_id), parsed_document);
if(doc_status == StoreStatus::NOT_FOUND) {
- LOG(WARNING) << "Sequence ID exists, but document is missing for id: " << id;
+ LOG(ERR) << "Sequence ID exists, but document is missing for id: " << id;
return Option<nlohmann::json>(404, "Could not find a document with id: " + id);
}
@@ -703,7 +703,7 @@ Option<std::string> Collection::remove(const std::string & id, const bool remove
StoreStatus doc_status = store->get(get_seq_id_key(seq_id), parsed_document);
if(doc_status == StoreStatus::NOT_FOUND) {
- LOG(WARNING) << "Sequence ID exists, but document is missing for id: " << id;
+ LOG(ERR) << "Sequence ID exists, but document is missing for id: " << id;
return Option<std::string>(404, "Could not find a document with id: " + id);
}