From 3aa94a099778714256179f0f652c15e539a37bce Mon Sep 17 00:00:00 2001 From: Vyacheslav Date: Mon, 10 Feb 2020 14:58:54 +0300 Subject: [PATCH] Added send function verification + licence --- include/spdlog/tcp_sink.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/spdlog/tcp_sink.h b/include/spdlog/tcp_sink.h index 36ec4324..1c44d644 100644 --- a/include/spdlog/tcp_sink.h +++ b/include/spdlog/tcp_sink.h @@ -1,3 +1,5 @@ +// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) #include #include @@ -32,7 +34,9 @@ protected: { spdlog::memory_buf_t formatted; spdlog::sinks::base_sink::formatter_->format(msg, formatted); - send(sock , formatted.data() , formatted.size() , 0 ); + int res = send(sock , formatted.data() , formatted.size() , 0 ); + if(res < 0) + SPDLOG_THROW(spdlog_ex("Message Send Failed", errno)); } void flush_() override