Skip to content

Commit

Permalink
Merge pull request input-leap#1877 from whot/wip/drop-raw-debugging-p…
Browse files Browse the repository at this point in the history
…riority

lib: drop raw protocol write/read messages to DEBUG5
  • Loading branch information
p12tic authored Mar 1, 2024
2 parents b372241 + 415a9cb commit 3991641
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lib/inputleap/ProtocolUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ProtocolUtil::writef(inputleap::IStream* stream, const char* fmt, ...)
{
assert(stream != nullptr);
assert(fmt != nullptr);
LOG_DEBUG2("writef(%s)", fmt);
LOG_DEBUG5("writef(%s)", fmt);

va_list args;
va_start(args, fmt);
Expand All @@ -49,7 +49,7 @@ ProtocolUtil::readf(inputleap::IStream* stream, const char* fmt, ...)
{
assert(stream != nullptr);
assert(fmt != nullptr);
LOG_DEBUG2("readf(%s)", fmt);
LOG_DEBUG5("readf(%s)", fmt);

bool result;
va_list args;
Expand Down Expand Up @@ -83,7 +83,7 @@ void ProtocolUtil::vwritef(inputleap::IStream* stream, const char* fmt, std::uin
try {
// write buffer
stream->write(buffer, size);
LOG_DEBUG2("wrote %d bytes", size);
LOG_DEBUG5("wrote %d bytes", size);

delete[] buffer;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
case 1:
// 1 byte integer
*static_cast<std::uint8_t*>(v) = buffer[0];
LOG_DEBUG2("readf: read %d byte integer: %d (0x%x)", len,
LOG_DEBUG5("readf: read %d byte integer: %d (0x%x)", len,
*static_cast<std::uint8_t*>(v), *static_cast<std::uint8_t*>(v));
break;

Expand All @@ -130,7 +130,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
static_cast<std::uint16_t>(
(static_cast<std::uint16_t>(buffer[0]) << 8) |
static_cast<std::uint16_t>(buffer[1]));
LOG_DEBUG2("readf: read %d byte integer: %d (0x%x)", len,
LOG_DEBUG5("readf: read %d byte integer: %d (0x%x)", len,
*static_cast<std::uint16_t*>(v), *static_cast<std::uint16_t*>(v));
break;

Expand All @@ -141,7 +141,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
(static_cast<std::uint32_t>(buffer[1]) << 16) |
(static_cast<std::uint32_t>(buffer[2]) << 8) |
static_cast<std::uint32_t>(buffer[3]);
LOG_DEBUG2("readf: read %d byte integer: %d (0x%x)", len,
LOG_DEBUG5("readf: read %d byte integer: %d (0x%x)", len,
*static_cast<std::uint32_t*>(v), *static_cast<std::uint32_t*>(v));
break;
default:
Expand Down Expand Up @@ -175,7 +175,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
read(stream, buffer, 1);
static_cast<std::vector<std::uint8_t>*>(v)->push_back(
buffer[0]);
LOG_DEBUG2("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
LOG_DEBUG5("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
static_cast<std::vector<std::uint8_t>*>(v)->back(),
static_cast<std::vector<std::uint8_t>*>(v)->back());
}
Expand All @@ -189,7 +189,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
static_cast<std::uint16_t>(
(static_cast<std::uint16_t>(buffer[0]) << 8) |
static_cast<std::uint16_t>(buffer[1])));
LOG_DEBUG2("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
LOG_DEBUG5("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
static_cast<std::vector<std::uint16_t>*>(v)->back(),
static_cast<std::vector<std::uint16_t>*>(v)->back());
}
Expand All @@ -204,7 +204,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
(static_cast<std::uint32_t>(buffer[1]) << 16) |
(static_cast<std::uint32_t>(buffer[2]) << 8) |
static_cast<std::uint32_t>(buffer[3]));
LOG_DEBUG2("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
LOG_DEBUG5("readf: read %d byte integer[%d]: %d (0x%x)", len, i,
static_cast<std::vector<std::uint32_t>*>(v)->back(),
static_cast<std::vector<std::uint32_t>*>(v)->back());
}
Expand Down Expand Up @@ -250,7 +250,7 @@ ProtocolUtil::vreadf(inputleap::IStream* stream, const char* fmt, va_list args)
throw;
}

LOG_DEBUG2("readf: read %d byte string", str_len);
LOG_DEBUG5("readf: read %d byte string", str_len);

// save the data
std::string* dst = va_arg(args, std::string*);
Expand Down

0 comments on commit 3991641

Please sign in to comment.