removed unneccessary namespace std

This commit is contained in:
Vyacheslav 2020-02-10 15:08:51 +03:00 committed by GitHub
parent 3aa94a0997
commit 4bb623a0a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,10 +3,11 @@
#include <spdlog/spdlog.h>
#include <spdlog/sinks/base_sink.h>
#include <spdlog/common-inl.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
using namespace std;
template<typename Mutex>
class tcp_sink : public spdlog::sinks::base_sink <Mutex>
{
@ -15,17 +16,17 @@ public:
{
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
SPDLOG_THROW(spdlog_ex("Socket creation error", errno));
SPDLOG_THROW(spdlog::spdlog_ex("Socket creation error", errno));
}
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
if(inet_pton(AF_INET, address.c_str(), &serv_addr.sin_addr)<=0)
{
SPDLOG_THROW(spdlog_ex("Invalid address/ Address not supported", errno));
SPDLOG_THROW(spdlog::spdlog_ex("Invalid address/ Address not supported", errno));
}
if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
{
SPDLOG_THROW(spdlog_ex("Connection Failed", errno));
SPDLOG_THROW(spdlog::spdlog_ex("Connection Failed", errno));
}
}
@ -36,7 +37,7 @@ protected:
spdlog::sinks::base_sink<Mutex>::formatter_->format(msg, formatted);
int res = send(sock , formatted.data() , formatted.size() , 0 );
if(res < 0)
SPDLOG_THROW(spdlog_ex("Message Send Failed", errno));
SPDLOG_THROW(spdlog::spdlog_ex("Message Send Failed", errno));
}
void flush_() override