Logging: calm down the most prolific Socket logging sites.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ia2ba1f114397cf8f61a4e42bdf55bdf4c0ac969a
pull/9054/head
Michael Meeks 2024-05-10 14:43:03 +01:00
parent 9b6ab4c601
commit 3746a51479
2 changed files with 24 additions and 24 deletions

View File

@ -411,7 +411,7 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
{
#if !MOBILEAPP
# if HAVE_PPOLL
LOG_TRC("ppoll start, timeoutMicroS: " << timeoutMaxMicroS << " size " << size);
LOGA_TRC(Socket, "ppoll start, timeoutMicroS: " << timeoutMaxMicroS << " size " << size);
timeoutMaxMicroS = std::max(timeoutMaxMicroS, (int64_t)0);
struct timespec timeout;
timeout.tv_sec = timeoutMaxMicroS / (1000 * 1000);
@ -429,8 +429,8 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
#endif
}
while (rc < 0 && errno == EINTR);
LOG_TRC("Poll completed with " << rc << " live polls max (" <<
timeoutMaxMicroS << "us)" << ((rc==0) ? "(timedout)" : ""));
LOGA_TRC(Socket, "Poll completed with " << rc << " live polls max (" <<
timeoutMaxMicroS << "us)" << ((rc==0) ? "(timedout)" : ""));
// from now we want to race back to sleep.
enableWatchdog();
@ -438,16 +438,16 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
// First process the wakeup pipe (always the last entry).
if (_pollFds[size].revents)
{
LOG_TRC('#' << _pollFds[size].fd << ": Handling events of wakeup pipe: 0x" << std::hex
<< _pollFds[size].revents << std::dec);
LOGA_TRC(Socket, '#' << _pollFds[size].fd << ": Handling events of wakeup pipe: 0x" << std::hex
<< _pollFds[size].revents << std::dec);
// Clear the data.
#if !MOBILEAPP
int dump[32];
dump[0] = ::read(_wakeup[0], &dump, sizeof(dump));
LOG_TRC("Wakeup pipe read " << dump[0] << " bytes");
LOGA_TRC(Socket, "Wakeup pipe read " << dump[0] << " bytes");
#else
LOG_TRC("Wakeup pipe read");
LOGA_TRC(Socket, "Wakeup pipe read");
int dump = fakeSocketRead(_wakeup[0], &dump, sizeof(dump));
#endif
@ -457,8 +457,8 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
if (!_newSockets.empty())
{
LOG_TRC("Inserting " << _newSockets.size() << " new sockets after the existing "
<< _pollSockets.size());
LOGA_TRC(Socket, "Inserting " << _newSockets.size() << " new sockets after the existing "
<< _pollSockets.size());
// Update thread ownership.
for (auto& i : _newSockets)
@ -475,7 +475,7 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
}
if (invoke.size() > 0)
LOG_TRC("Invoking " << invoke.size() << " callbacks");
LOGA_TRC(Socket, "Invoking " << invoke.size() << " callbacks");
for (const auto& callback : invoke)
{
try
@ -539,9 +539,9 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
SocketDisposition disposition(_pollSockets[i]);
try
{
LOG_TRC('#' << _pollFds[i].fd << ": Handling poll events of " << _name
<< " at index " << i << " (of " << size << "): 0x" << std::hex
<< _pollFds[i].revents << std::dec);
LOGA_TRC(Socket, '#' << _pollFds[i].fd << ": Handling poll events of " << _name
<< " at index " << i << " (of " << size << "): 0x" << std::hex
<< _pollFds[i].revents << std::dec);
_pollSockets[i]->handlePoll(disposition, newNow, _pollFds[i].revents);
}
@ -556,8 +556,8 @@ int SocketPoll::poll(int64_t timeoutMaxMicroS)
if (!disposition.isContinue())
{
itemsErased++;
LOG_TRC('#' << _pollFds[i].fd << ": Removing socket (at " << i
<< " of " << _pollSockets.size() << ") from " << _name);
LOGA_TRC(Socket, '#' << _pollFds[i].fd << ": Removing socket (at " << i
<< " of " << _pollSockets.size() << ") from " << _name);
_pollSockets[i] = nullptr;
}

View File

@ -869,8 +869,8 @@ private:
_pollFds[i].fd = _pollSockets[i]->getFD();
_pollFds[i].events = events;
_pollFds[i].revents = 0;
LOG_TRC('#' << _pollFds[i].fd << ": setupPollFds getPollEvents: 0x" << std::hex
<< events << std::dec);
LOGA_TRC(Socket, '#' << _pollFds[i].fd << ": setupPollFds getPollEvents: 0x" << std::hex
<< events << std::dec);
}
// Add the read-end of the wake pipe.
@ -1146,17 +1146,17 @@ public:
LOG_SYS_ERRNO(last_errno,
"Read failed, have " << _inBuffer.size() << " buffered bytes");
else if (len < 0)
LOG_TRC("Read failed ("
LOGA_TRC(Socket, "Read failed ("
<< len << "), have " << _inBuffer.size() << " buffered bytes ("
<< Util::symbolicErrno(last_errno) << ": " << std::strerror(last_errno)
<< ')');
else if (len == 0)
LOG_TRC("Read closed (0), have " << _inBuffer.size() << " buffered bytes");
LOGA_TRC(Socket, "Read closed (0), have " << _inBuffer.size() << " buffered bytes");
else // Success.
LOG_TRC("Read " << len << " bytes in addition to " << _inBuffer.size()
<< " buffered bytes"
LOGA_TRC(Socket, "Read " << len << " bytes in addition to " << _inBuffer.size()
<< " buffered bytes"
#ifdef LOG_SOCKET_DATA
<< (len ? Util::dumpHex(std::string(buf, len), ":\n") : std::string())
<< (len ? Util::dumpHex(std::string(buf, len), ":\n") : std::string())
#endif
);
} while (len < 0 && last_errno == EINTR);
@ -1333,7 +1333,7 @@ protected:
// Oddly enough, we don't necessarily get POLLHUP after read(2) returns 0.
const int read = readIncomingData();
const int last_errno = errno;
LOG_TRC("Incoming data buffer "
LOGA_TRC(Socket, "Incoming data buffer "
<< _inBuffer.size() << " bytes, read result: " << read << ", events: 0x"
<< std::hex << events << std::dec << " (" << (closed ? "closed" : "not closed")
<< ')'
@ -1466,7 +1466,7 @@ public:
<< Util::symbolicErrno(last_errno) << ": "
<< std::strerror(last_errno) << ')');
else // Success.
LOG_TRC("Wrote " << len << " bytes of " << _outBuffer.size() << " buffered data"
LOGA_TRC(Socket, "Wrote " << len << " bytes of " << _outBuffer.size() << " buffered data"
#ifdef LOG_SOCKET_DATA
<< (len ? Util::dumpHex(std::string(_outBuffer.getBlock(), len), ":\n")
: std::string())