summaryrefslogtreecommitdiffstats
path: root/src/Client
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client')
-rw-r--r--src/Client/CommandParser.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index ccf5a74..87202b4 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -59,7 +59,7 @@ void CommandParser::printUsage(const std::string& command) {
const CommandParser::Command *cmd = findCommand(command);
if(cmd)
- Common::Logger::log(std::string("Usage: ") + cmd->cmdline + "\n");
+ Common::Logger::logf("Usage: %s\n", cmd->cmdline);
}
void CommandParser::printHostStatus(const Net::Packets::HostStatusPacket &packet) {
@@ -135,10 +135,10 @@ void CommandParser::helpCommand(const std::vector<std::string> &args) {
std::cout << command->longdesc << std::endl << std::endl;
}
else
- Common::Logger::log(Common::Logger::WARNING, args[0] + ": Command '" + args[1] + "' doesn't exist.\n");
+ Common::Logger::logf(Common::Logger::WARNING,"%s: Command '%s' doesn't exist.\n", args[0].c_str(), args[1].c_str());
}
else {
- Common::Logger::log(Common::Logger::ERROR, args[0] + ": Too many arguments.");
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("help");
}
}
@@ -154,7 +154,7 @@ void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
);
}
else if(args.size() > 2) {
- Common::Logger::log(Common::Logger::ERROR, args[0] + ": Too many arguments.");
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("list_hosts");
return;
}
@@ -168,7 +168,7 @@ void CommandParser::listHostsCommand(const std::vector<std::string> &args) {
);
}
else {
- Common::Logger::log(Common::Logger::ERROR, args[0] + ": Don't unterstand argument '" + args[1] + "'.");
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Don't unterstand argument '%s'.", args[0].c_str(), args[1].c_str());
printUsage("list_hosts");
return;
}
@@ -182,7 +182,7 @@ void CommandParser::statusCommand(const std::vector<std::string> &args) {
else if(args.size() == 2)
Common::RequestManager::getRequestManager()->sendRequest(connection, std::auto_ptr<Common::RequestBase>(new Requests::DaemonStatusRequest(args[1], sigc::mem_fun(this, &CommandParser::daemonStatusRequestFinished))));
else {
- Common::Logger::log(Common::Logger::ERROR, args[0] + ": Too many arguments.");
+ Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("status");
return;
}
@@ -203,7 +203,7 @@ void CommandParser::coreStatusRequestFinished(const Common::Request<Net::Packets
printHostStatus(packet);
}
catch(Common::Exception &exception) {
- Common::Logger::log(Common::Logger::ERROR, std::string("An error occurred during your request: ") + exception.strerror() + ".\n");
+ Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.\n", exception.strerror().c_str());
}
requestFinished();
@@ -243,7 +243,7 @@ void CommandParser::daemonListRequestFinished(const Common::Request<Net::Packets
}
}
catch(Common::Exception &exception) {
- Common::Logger::log(Common::Logger::ERROR, std::string("An error occurred during your request: ") + exception.strerror() + ".\n");
+ Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.\n", exception.strerror().c_str());
}
requestFinished();
@@ -256,7 +256,7 @@ void CommandParser::daemonStatusRequestFinished(const Common::Request<Net::Packe
printHostStatus(packet);
}
catch(Common::Exception &exception) {
- Common::Logger::log(Common::Logger::ERROR, std::string("An error occurred during your request: ") + exception.strerror() + ".\n");
+ Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.\n", exception.strerror().c_str());
}
requestFinished();
@@ -268,7 +268,7 @@ void CommandParser::disconnectRequestFinished(const Common::Request<> &request)
disconnect = true;
}
catch(Common::Exception &exception) {
- Common::Logger::log(Common::Logger::ERROR, std::string("An error occurred during your request: ") + exception.strerror() + ".\n");
+ Common::Logger::logf(Common::Logger::ERROR, "An error occurred during your request: %s.\n", exception.strerror().c_str());
}
requestFinished();
@@ -344,7 +344,7 @@ bool CommandParser::parse(const std::string &cmd) {
if(command)
(this->*command->funcPtr)(splitCmd);
else
- Common::Logger::log(Common::Logger::ERROR, "Unknown command '" + splitCmd[0] + "'.\n");
+ Common::Logger::logf(Common::Logger::ERROR, "Unknown command '%s'.\n", splitCmd[0].c_str());
return true;
}