mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
removed unneccessary namespace std
This commit is contained in:
parent
3aa94a0997
commit
4bb623a0a3
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
@ -35,8 +36,8 @@ protected:
|
||||
spdlog::memory_buf_t formatted;
|
||||
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));
|
||||
if(res < 0)
|
||||
SPDLOG_THROW(spdlog::spdlog_ex("Message Send Failed", errno));
|
||||
}
|
||||
|
||||
void flush_() override
|
||||
|
Loading…
Reference in New Issue
Block a user