summaryrefslogtreecommitdiffstats
path: root/src/madc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/madc.cpp')
-rw-r--r--src/madc.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/madc.cpp b/src/madc.cpp
index 12a190e..66e235d 100644
--- a/src/madc.cpp
+++ b/src/madc.cpp
@@ -19,6 +19,8 @@
#include "Net/ClientConnection.h"
#include "Net/IPAddress.h"
+#include "Common/Logger.h"
+#include "Common/Backends/ConsoleLogger.h"
#include "Common/RequestManager.h"
#include "Common/Util.h"
#include "Client/CommandParser.h"
@@ -70,6 +72,9 @@ int main(int argc, char *argv[]) {
std::exit(1);
}
+ Mad::Common::Backends::ConsoleLogger logger;
+ Mad::Common::Logger::registerLogger(&logger);
+
Mad::Net::Connection::init();
Mad::Common::RequestManager::init(false);
@@ -78,7 +83,7 @@ int main(int argc, char *argv[]) {
try {
connection->connect(Mad::Net::IPAddress(argv[1]));
- std::cout << "Connecting to " << argv[1] << "..." << std::flush;
+ std::cerr << "Connecting to " << argv[1] << "..." << std::flush;
while(connection->isConnecting()) {
struct pollfd fd = connection->getPollfd();
@@ -87,7 +92,7 @@ int main(int argc, char *argv[]) {
connection->sendReceive(fd.revents);
}
- std::cout << " connected." << std::endl << std::endl;
+ std::cerr << " connected." << std::endl << std::endl;
Mad::Common::RequestManager::getRequestManager()->registerConnection(connection);
@@ -114,7 +119,7 @@ int main(int argc, char *argv[]) {
Mad::Common::RequestManager::getRequestManager()->unregisterConnection(connection);
}
catch(Mad::Net::Exception &e) {
- std::cerr << "Connection error: " << e.what() << std::endl;
+ Mad::Common::Logger::log(Mad::Common::Logger::CRITICAL, "Connection error: " + e.what());
}
delete connection;