summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-21 16:07:50 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-05-21 16:07:50 +0200
commit305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36 (patch)
tree53fb36abafba8712c66a23829a95e84b85c98c50 /src/network
parent2017-05-18 (diff)
downloadAltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar.gz
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar.bz2
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar.lz
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar.xz
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.tar.zst
AltCraft-305efbfdc5fb5c05c9b72aa0bee6a3ae1983de36.zip
Diffstat (limited to 'src/network')
-rw-r--r--src/network/Network.cpp11
-rw-r--r--src/network/Network.hpp1
2 files changed, 6 insertions, 6 deletions
diff --git a/src/network/Network.cpp b/src/network/Network.cpp
index a3023ff..03ee6c6 100644
--- a/src/network/Network.cpp
+++ b/src/network/Network.cpp
@@ -3,24 +3,23 @@
#include "../packet/PacketBuilder.hpp"
Network::Network(std::string address, unsigned short port) : m_address(address), m_port(port) {
- std::cout << "Connecting to server " << m_address << ":" << m_port << std::endl;
+ LOG(INFO) << "Connecting to server " << m_address << ":" << m_port;
sf::Socket::Status status = m_socket.connect(sf::IpAddress(m_address), m_port);
m_socket.setBlocking(true);
if (status != sf::Socket::Done) {
if (status == sf::Socket::Error) {
- std::cerr << "Can't connect to remote server" << std::endl;
- throw 14;
+ LOG(ERROR) << "Can't connect to remote server";
} else {
- std::cerr << "Connection failed with unknown reason" << std::endl;
+ LOG(ERROR) << "Connection failed with unknown reason";
throw 13;
}
}
- std::cout << "Connected." << std::endl;
+ LOG(INFO) << "Connected to server";
}
Network::~Network() {
- std::cout << "Disconnecting..." << std::endl;
m_socket.disconnect();
+ LOG(INFO) << "Disconnected";
}
void Network::SendHandshake(std::string username) {
diff --git a/src/network/Network.hpp b/src/network/Network.hpp
index ea9042c..7d8cfeb 100644
--- a/src/network/Network.hpp
+++ b/src/network/Network.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <string>
+#include <easylogging++.h>
#include <SFML/Network.hpp>
#include "../packet/Packet.hpp"