log: replace all NGLOG with LOG

This commit is contained in:
wwylele 2018-06-29 14:18:07 +03:00
parent fde415968e
commit 7c5a76e58b
152 changed files with 1541 additions and 1541 deletions

View file

@ -50,7 +50,7 @@ void from_json(const nlohmann::json& json, Room& room) {
try {
room.members = json.at("players").get<std::vector<Room::Member>>();
} catch (const nlohmann::detail::out_of_range& e) {
NGLOG_DEBUG(Network, "Out of range {}", e.what());
LOG_DEBUG(Network, "Out of range {}", e.what());
}
}

View file

@ -38,7 +38,7 @@ std::unique_ptr<httplib::Client> GetClientFor(const LUrlParser::clParseURL& pars
}
return std::make_unique<hl::SSLClient>(parsedUrl.m_Host.c_str(), port, TIMEOUT_SECONDS);
} else {
NGLOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme);
return nullptr;
}
}
@ -52,7 +52,7 @@ std::future<Common::WebResult> PostJson(const std::string& url, const std::strin
lup parsedUrl = lup::ParseURL(url);
if (url.empty() || !parsedUrl.IsValid()) {
NGLOG_ERROR(WebService, "URL is invalid");
LOG_ERROR(WebService, "URL is invalid");
return std::async(std::launch::deferred, []() {
return Common::WebResult{Common::WebResult::Code::InvalidURL, "URL is invalid"};
});
@ -60,7 +60,7 @@ std::future<Common::WebResult> PostJson(const std::string& url, const std::strin
const bool are_credentials_provided{!token.empty() && !username.empty()};
if (!allow_anonymous && !are_credentials_provided) {
NGLOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
LOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
return std::async(std::launch::deferred, []() {
return Common::WebResult{Common::WebResult::Code::CredentialsMissing,
"Credentials needed"};
@ -98,12 +98,12 @@ std::future<Common::WebResult> PostJson(const std::string& url, const std::strin
hl::Response response;
if (!cli->send(request, response)) {
NGLOG_ERROR(WebService, "POST to {} returned null", url);
LOG_ERROR(WebService, "POST to {} returned null", url);
return Common::WebResult{Common::WebResult::Code::LibError, "Null response"};
}
if (response.status >= 400) {
NGLOG_ERROR(WebService, "POST to {} returned error status code: {}", url,
LOG_ERROR(WebService, "POST to {} returned error status code: {}", url,
response.status);
return Common::WebResult{Common::WebResult::Code::HttpError,
std::to_string(response.status)};
@ -113,7 +113,7 @@ std::future<Common::WebResult> PostJson(const std::string& url, const std::strin
if (content_type == response.headers.end() ||
content_type->second.find("application/json") == std::string::npos) {
NGLOG_ERROR(WebService, "POST to {} returned wrong content: {}", url,
LOG_ERROR(WebService, "POST to {} returned wrong content: {}", url,
content_type->second);
return Common::WebResult{Common::WebResult::Code::WrongContent, content_type->second};
}
@ -132,13 +132,13 @@ std::future<T> GetJson(std::function<T(const std::string&)> func, const std::str
lup parsedUrl = lup::ParseURL(url);
if (url.empty() || !parsedUrl.IsValid()) {
NGLOG_ERROR(WebService, "URL is invalid");
LOG_ERROR(WebService, "URL is invalid");
return std::async(std::launch::deferred, [func{std::move(func)}]() { return func(""); });
}
const bool are_credentials_provided{!token.empty() && !username.empty()};
if (!allow_anonymous && !are_credentials_provided) {
NGLOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
LOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
return std::async(std::launch::deferred, [func{std::move(func)}]() { return func(""); });
}
@ -170,12 +170,12 @@ std::future<T> GetJson(std::function<T(const std::string&)> func, const std::str
hl::Response response;
if (!cli->send(request, response)) {
NGLOG_ERROR(WebService, "GET to {} returned null", url);
LOG_ERROR(WebService, "GET to {} returned null", url);
return func("");
}
if (response.status >= 400) {
NGLOG_ERROR(WebService, "GET to {} returned error status code: {}", url,
LOG_ERROR(WebService, "GET to {} returned error status code: {}", url,
response.status);
return func("");
}
@ -184,7 +184,7 @@ std::future<T> GetJson(std::function<T(const std::string&)> func, const std::str
if (content_type == response.headers.end() ||
content_type->second.find("application/json") == std::string::npos) {
NGLOG_ERROR(WebService, "GET to {} returned wrong content: {}", url,
LOG_ERROR(WebService, "GET to {} returned wrong content: {}", url,
content_type->second);
return func("");
}
@ -209,13 +209,13 @@ void DeleteJson(const std::string& url, const std::string& data, const std::stri
lup parsedUrl = lup::ParseURL(url);
if (url.empty() || !parsedUrl.IsValid()) {
NGLOG_ERROR(WebService, "URL is invalid");
LOG_ERROR(WebService, "URL is invalid");
return;
}
const bool are_credentials_provided{!token.empty() && !username.empty()};
if (!are_credentials_provided) {
NGLOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
LOG_ERROR(WebService, "Credentials must be provided for authenticated requests");
return;
}
@ -242,12 +242,12 @@ void DeleteJson(const std::string& url, const std::string& data, const std::stri
hl::Response response;
if (!cli->send(request, response)) {
NGLOG_ERROR(WebService, "DELETE to {} returned null", url);
LOG_ERROR(WebService, "DELETE to {} returned null", url);
return;
}
if (response.status >= 400) {
NGLOG_ERROR(WebService, "DELETE to {} returned error status code: {}", url,
LOG_ERROR(WebService, "DELETE to {} returned error status code: {}", url,
response.status);
return;
}
@ -256,7 +256,7 @@ void DeleteJson(const std::string& url, const std::string& data, const std::stri
if (content_type == response.headers.end() ||
content_type->second.find("application/json") == std::string::npos) {
NGLOG_ERROR(WebService, "DELETE to {} returned wrong content: {}", url,
LOG_ERROR(WebService, "DELETE to {} returned wrong content: {}", url,
content_type->second);
return;
}