From 72669bf92983133b9ece5969f8ed0205b4d9eae5 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Mon, 27 Feb 2017 21:35:06 -0500 Subject: [PATCH] nb: logging Change-Id: Ia67f746a6c71b4753d04b92472eddf1614c0d337 --- net/Socket.hpp | 11 +++++++---- wsd/FileServer.cpp | 2 +- wsd/LOOLWSD.cpp | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/net/Socket.hpp b/net/Socket.hpp index a5966aa1e..1aa6ff921 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -426,8 +426,8 @@ protected: auto& log = Log::logger(); if (log.trace()) { - LOG_TRC("Incoming data buffer " << _inBuffer.size() << - " closeSocket? " << _closed); + LOG_TRC("#" << getFD() << ": Incoming data buffer " << _inBuffer.size() << + " bytes, closeSocket? " << closed); log.dump("", &_inBuffer[0], _inBuffer.size()); } @@ -507,12 +507,12 @@ protected: if (log.trace()) { if (len > 0) { - LOG_TRC("Wrote outgoing data " << len << " bytes"); + LOG_TRC("#" << getFD() << ": Wrote outgoing data " << len << " bytes"); log.dump("", &_outBuffer[0], len); } else { - LOG_SYS("Wrote outgoing data " << len << " bytes"); + LOG_SYS("#" << getFD() << ": Wrote outgoing data " << len << " bytes"); } } } @@ -569,7 +569,10 @@ namespace HttpHelper { struct stat st; if (stat(path.c_str(), &st) != 0) + { + LOG_WRN("Failed to stat [" << path << "]. File will not be sent."); return; + } std::ostringstream oss; oss << "HTTP/1.1 200 OK\r\n" diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp index 01d247369..846238612 100644 --- a/wsd/FileServer.cpp +++ b/wsd/FileServer.cpp @@ -307,7 +307,7 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, const << preprocess; socket->send(oss.str()); - LOG_DBG("Sent file: " << path.toString()); + LOG_DBG("Sent file: " << path.toString() << ": " << preprocess); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 602c1d1e6..6c6ea14da 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -2795,7 +2795,7 @@ private: auto socket = _socket.lock(); socket->send(oss.str()); socket->shutdown(); - LOG_INF("Sent discovery.xml successfully."); + LOG_INF("Sent / response successfully."); } void handleFaviconRequest(const Poco::Net::HTTPRequest& request)