Skip to content

Commit

Permalink
campaignd: Move error messages to the error logger, drop inline "ERRO…
Browse files Browse the repository at this point in the history
…R" label

This includes messages emitted by the send_error() method, which is used
all over the place.

(Backported d1dd66d from master.)
  • Loading branch information
irydacea committed Oct 11, 2014
1 parent 0133872 commit 09e4374
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/campaign_server/campaign_server.cpp
Expand Up @@ -179,7 +179,7 @@ void server::load_blacklist()
blacklist_.read(blcfg);
LOG_CS << "using blacklist from " << blacklist_file_ << '\n';
} catch(const config::error&) {
LOG_CS << "ERROR: failed to read blacklist from " << blacklist_file_ << ", blacklist disabled\n";
ERR_CS << "failed to read blacklist from " << blacklist_file_ << ", blacklist disabled\n";
}
}

Expand All @@ -202,13 +202,13 @@ void server::fire(const std::string& hook, const std::string& addon)
}

#if defined(_WIN32)
LOG_CS << "ERROR: Tried to execute a script on an unsupported platform" << std::endl;
ERR_CS << "Tried to execute a script on an unsupported platform\n";
return;
#else
pid_t childpid;

if((childpid = fork()) == -1) {
LOG_CS << "ERROR: fork failed while updating campaign " << addon << std::endl;
ERR_CS << "fork failed while updating campaign " << addon << '\n';
return;
}

Expand Down Expand Up @@ -240,7 +240,7 @@ void server::send_error(const std::string& msg, network::connection sock)
{
config cfg;
cfg.add_child("error")["message"] = msg;
LOG_CS << "ERROR [" << network::ip_address(sock) << "]: " << msg << '\n';
ERR_CS << "[" << network::ip_address(sock) << "]: " << msg << '\n';
network::send_data(cfg, sock);
}

Expand Down Expand Up @@ -300,7 +300,7 @@ void server::run()
}
} catch(network::error& e) {
if(!e.socket) {
LOG_CS << "fatal network error: " << e.message << "\n";
ERR_CS << "fatal network error: " << e.message << "\n";
throw;
} else {
LOG_CS << "client disconnect: " << e.message << " " << network::ip_address(e.socket) << "\n";
Expand All @@ -319,7 +319,7 @@ void server::run()
}

if(err_sock) {
LOG_CS << "client disconnect due to exception: " << e.what() << " " << network::ip_address(err_sock) << "\n";
ERR_CS << "client disconnect due to exception: " << e.what() << " " << network::ip_address(err_sock) << "\n";
network::disconnect(err_sock);
} else {
throw;
Expand Down Expand Up @@ -447,7 +447,7 @@ void server::handle_request_campaign(const server::request& req)

if(size < 0) {
std::cerr << " size: <unknown> KiB\n";
LOG_CS << "File size unknown, aborting send.\n";
ERR_CS << "File size unknown, aborting send.\n";
send_error("Add-on '" + req.cfg["name"].str() + "' could not be read by the server.", req.sock);
return;
}
Expand Down Expand Up @@ -657,7 +657,7 @@ void server::handle_delete(const server::request& req)
// Erase the campaign.
write_file(campaign["filename"], std::string());
if(remove(campaign["filename"].str().c_str()) != 0) {
LOG_CS << "failed to delete archive for campaign '" << erase["name"]
ERR_CS << "failed to delete archive for campaign '" << erase["name"]
<< "' (" << campaign["filename"] << "): " << strerror(errno)
<< '\n';
}
Expand Down

0 comments on commit 09e4374

Please sign in to comment.