diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-17 22:18:09 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-17 22:18:09 +0200 |
commit | d84a3b91346038bf55d7111462dab42a0a26445d (patch) | |
tree | 1e9eca4eba2a8da8f616815e56385725310fe148 /src/Core | |
parent | cccc512e2565b7b96b765bfb873f0fb635bd23e1 (diff) | |
download | mad-d84a3b91346038bf55d7111462dab42a0a26445d.tar mad-d84a3b91346038bf55d7111462dab42a0a26445d.zip |
Logger f?r Log-Messages benutzen
Diffstat (limited to 'src/Core')
5 files changed, 12 insertions, 18 deletions
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index 2926fbf..3007fd6 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -19,6 +19,7 @@ #include "ConnectionManager.h" #include "ConfigManager.h" +#include <Common/Logger.h> #include <Common/RequestHandlers/StatusRequestHandler.h> #include "RequestHandlers/DaemonListRequestHandler.h" #include "RequestHandlers/DaemonStatusRequestHandler.h" @@ -31,8 +32,6 @@ #include <unistd.h> #include <algorithm> -#include <iostream> - namespace Mad { namespace Core { @@ -190,13 +189,13 @@ void ConnectionManager::identifyDaemonConnection(Net::Connection *connection, co if(idCon->second) { idCon->second->disconnect(); - std::cerr << "Disconnecting old connection" << std::endl; + Common::Logger::log(Common::Logger::WARNING, "Disconnecting old connection."); } idCon->second = *con; connection->setIdentified(); - std::cerr << "Identified as '" << name << "'." << std::endl; + Common::Logger::log("Identified as '" + name + "'."); } std::map<std::string,DaemonInfo> ConnectionManager::getDaemonList() const { diff --git a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp index 2bee423..2a6b119 100644 --- a/src/Core/RequestHandlers/DaemonListRequestHandler.cpp +++ b/src/Core/RequestHandlers/DaemonListRequestHandler.cpp @@ -19,19 +19,18 @@ #include "DaemonListRequestHandler.h" #include "../ConnectionManager.h" +#include <Common/Logger.h> #include <Net/Connection.h> #include <Net/Packets/ErrorPacket.h> #include <Net/Packets/NameListPacket.h> -#include <iostream> - namespace Mad { namespace Core { namespace RequestHandlers { void DaemonListRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { if(packet.getType() != Net::Packet::LIST_DAEMONS) { - std::cerr << "Received an unexpected packet." << std::endl; + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), Common::Exception(Common::Exception::UNEXPECTED_PACKET))); signalFinished().emit(); diff --git a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp index efdf3ea..7fcf9fe 100644 --- a/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp +++ b/src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp @@ -19,12 +19,11 @@ #include "DaemonStatusRequestHandler.h" #include "../ConnectionManager.h" +#include <Common/Logger.h> #include <Core/Requests/DaemonStatusRequest.h> #include <Net/Packets/ErrorPacket.h> #include <Net/Packets/HostStatusPacket.h> -#include <iostream> - namespace Mad { namespace Core { @@ -32,7 +31,7 @@ namespace RequestHandlers { void DaemonStatusRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { if(packet.getType() != Net::Packet::DAEMON_STATUS) { - std::cerr << "Received an unexpected packet." << std::endl; + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), Common::Exception(Common::Exception::UNEXPECTED_PACKET))); signalFinished().emit(); diff --git a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp index d65da7e..e459511 100644 --- a/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp +++ b/src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp @@ -18,13 +18,12 @@ */ #include "GSSAPIAuthRequestHandler.h" +#include <Common/Logger.h> #include <Net/Connection.h> #include <Net/Packets/ErrorPacket.h> #include <cstring> -#include <iostream> - namespace Mad { namespace Core { namespace RequestHandlers { @@ -33,7 +32,7 @@ namespace RequestHandlers { void GSSAPIAuthRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { if(packet.getType() != Net::Packet::GSSAPI_AUTH) { - std::cerr << "Received an unexpected packet." << std::endl; + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), Common::Exception(Common::Exception::UNEXPECTED_PACKET))); signalFinished().emit(); @@ -55,7 +54,7 @@ void GSSAPIAuthRequestHandler::handlePacket(Net::Connection *connection, const N std::free(recvBuffer.value); if(majStat == GSS_S_COMPLETE) { - std::cout << "GSS context established." << std::endl; + Common::Logger::log(Common::Logger::VERBOSE, "GSS context established."); gssContinue = false; } else if(majStat != GSS_S_CONTINUE_NEEDED) { diff --git a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp index 4e65aca..0d4f25d 100644 --- a/src/Core/RequestHandlers/IdentifyRequestHandler.cpp +++ b/src/Core/RequestHandlers/IdentifyRequestHandler.cpp @@ -19,12 +19,10 @@ #include "IdentifyRequestHandler.h" #include "../ConnectionManager.h" -#include <Common/Exception.h> +#include <Common/Logger.h> #include <Net/Connection.h> #include <Net/Packets/ErrorPacket.h> -#include <iostream> - namespace Mad { namespace Core { @@ -32,7 +30,7 @@ namespace RequestHandlers { void IdentifyRequestHandler::handlePacket(Net::Connection *connection, const Net::Packet &packet) { if(packet.getType() != Net::Packet::IDENTIFY) { - std::cerr << "Received an unexpected packet." << std::endl; + Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); connection->send(Net::Packets::ErrorPacket(Net::Packet::ERROR, packet.getRequestId(), Common::Exception(Common::Exception::UNEXPECTED_PACKET))); signalFinished().emit(); |