Code Style naming

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

View File

@ -14,17 +14,17 @@ class tcp_sink : public spdlog::sinks::base_sink <Mutex>
public: public:
tcp_sink(std::string address,int port) tcp_sink(std::string address,int port)
{ {
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) if ((sock_ = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{ {
SPDLOG_THROW(spdlog::spdlog_ex("Socket creation error", errno)); SPDLOG_THROW(spdlog::spdlog_ex("Socket creation error", errno));
} }
serv_addr.sin_family = AF_INET; serv_addr_.sin_family = AF_INET;
serv_addr.sin_port = htons(port); serv_addr_.sin_port = htons(port);
if(inet_pton(AF_INET, address.c_str(), &serv_addr.sin_addr)<=0) if(inet_pton(AF_INET, address.c_str(), &serv_addr_.sin_addr)<=0)
{ {
SPDLOG_THROW(spdlog::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) if (connect(sock_, (struct sockaddr *)&serv_addr_, sizeof(serv_addr_)) < 0)
{ {
SPDLOG_THROW(spdlog::spdlog_ex("Connection Failed", errno)); SPDLOG_THROW(spdlog::spdlog_ex("Connection Failed", errno));
} }
@ -35,7 +35,7 @@ protected:
{ {
spdlog::memory_buf_t formatted; spdlog::memory_buf_t formatted;
spdlog::sinks::base_sink<Mutex>::formatter_->format(msg, formatted); spdlog::sinks::base_sink<Mutex>::formatter_->format(msg, formatted);
int res = send(sock , formatted.data() , formatted.size() , 0 ); int res = send(sock_ , formatted.data() , formatted.size() , 0 );
if(res < 0) if(res < 0)
SPDLOG_THROW(spdlog::spdlog_ex("Message Send Failed", errno)); SPDLOG_THROW(spdlog::spdlog_ex("Message Send Failed", errno));
} }
@ -44,8 +44,8 @@ protected:
{ {
} }
private: private:
int sock; int sock_;
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr_;
}; };
using tcp_sink_mt = tcp_sink<std::mutex>; using tcp_sink_mt = tcp_sink<std::mutex>;
using tcp_sink_st = tcp_sink<spdlog::details::null_mutex>; using tcp_sink_st = tcp_sink<spdlog::details::null_mutex>;