From d84a3b91346038bf55d7111462dab42a0a26445d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 17 Sep 2008 22:18:09 +0200 Subject: Logger f?r Log-Messages benutzen --- src/Core/ConnectionManager.cpp | 7 +++---- src/Core/RequestHandlers/DaemonListRequestHandler.cpp | 5 ++--- src/Core/RequestHandlers/DaemonStatusRequestHandler.cpp | 5 ++--- src/Core/RequestHandlers/GSSAPIAuthRequestHandler.cpp | 7 +++---- src/Core/RequestHandlers/IdentifyRequestHandler.cpp | 6 ++---- 5 files changed, 12 insertions(+), 18 deletions(-) (limited to 'src/Core') 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 #include #include "RequestHandlers/DaemonListRequestHandler.h" #include "RequestHandlers/DaemonStatusRequestHandler.h" @@ -31,8 +32,6 @@ #include #include -#include - 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 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 #include #include #include -#include - 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 #include #include #include -#include - 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 #include #include #include -#include - 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 +#include #include #include -#include - 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(); -- cgit v1.2.3