mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 19:33:45 +02:00
Replace additional #ifdef debug related w/ if constexpr for regression visibility.
This commit is contained in:
parent
f1676fdb80
commit
716134186e
|
@ -27,6 +27,8 @@ namespace ircd::m::media::file
|
|||
{
|
||||
using closure = std::function<void (const const_buffer &)>;
|
||||
|
||||
constexpr bool debug_read {false};
|
||||
|
||||
room::id room_id(room::id::buf &out, const mxc &);
|
||||
room::id::buf room_id(const mxc &);
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ ircd::net::acceptor
|
|||
IRCD_EXCEPTION(listener::error, error)
|
||||
IRCD_EXCEPTION(error, sni_warning)
|
||||
|
||||
static constexpr bool debug_alpn {false};
|
||||
|
||||
static log::log log;
|
||||
static ios::descriptor accept_desc;
|
||||
static ios::descriptor handshake_desc;
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace ircd::magick
|
|||
struct display;
|
||||
struct transform;
|
||||
|
||||
constexpr bool debug_progress {false};
|
||||
|
||||
[[noreturn]] static void handle_exception(const ExceptionType, const char *, const char *);
|
||||
static void handle_fatal(const ExceptionType, const char *, const char *) __attribute__((noreturn));
|
||||
static void handle_error(const ExceptionType, const char *, const char *) noexcept;
|
||||
|
@ -664,18 +666,17 @@ noexcept try
|
|||
|
||||
// This debug message is very noisy, even for debug mode. Developer can
|
||||
// enable it at their discretion.
|
||||
#ifdef IRCD_MAGICK_DEBUG_PROGRESS
|
||||
log::debug
|
||||
{
|
||||
log, "job:%lu progress %2.2lf%% (%ld/%ld) cycles:%lu :%s",
|
||||
job::cur.id,
|
||||
(job::cur.tick / double(job::cur.ticks) * 100.0),
|
||||
job::cur.tick,
|
||||
job::cur.ticks,
|
||||
job::cur.cycles,
|
||||
job::cur.text,
|
||||
};
|
||||
#endif
|
||||
if constexpr(debug_progress)
|
||||
log::debug
|
||||
{
|
||||
log, "job:%lu progress %2.2lf%% (%ld/%ld) cycles:%lu :%s",
|
||||
job::cur.id,
|
||||
(job::cur.tick / double(job::cur.ticks) * 100.0),
|
||||
job::cur.tick,
|
||||
job::cur.ticks,
|
||||
job::cur.cycles,
|
||||
job::cur.text,
|
||||
};
|
||||
|
||||
check_cycles(job::cur);
|
||||
check_yield(job::cur);
|
||||
|
|
|
@ -852,19 +852,18 @@ ircd::net::acceptor::handle_alpn(socket &socket,
|
|||
size(in),
|
||||
};
|
||||
|
||||
#ifdef IRCD_NET_ACCEPTOR_DEBUG_ALPN
|
||||
for(size_t i(0); i < size(in); ++i)
|
||||
{
|
||||
log::debug
|
||||
if constexpr(debug_alpn)
|
||||
for(size_t i(0); i < size(in); ++i)
|
||||
{
|
||||
log, "%s ALPN protocol %zu of %zu: '%s'",
|
||||
loghead(socket),
|
||||
i,
|
||||
size(in),
|
||||
in[i],
|
||||
};
|
||||
}
|
||||
#endif IRCD_NET_ACCEPTOR_DEBUG_ALPN
|
||||
log::debug
|
||||
{
|
||||
log, "%s ALPN protocol %zu of %zu: '%s'",
|
||||
loghead(socket),
|
||||
i,
|
||||
size(in),
|
||||
in[i],
|
||||
};
|
||||
}
|
||||
|
||||
//NOTE: proto == "h2" condition goes here
|
||||
for(const auto &proto : in)
|
||||
|
|
|
@ -396,20 +396,20 @@ ircd::m::media::file::read(const m::room &room,
|
|||
b64::decode(blk_decode_buf, blk_encoded)
|
||||
};
|
||||
|
||||
#ifdef IRCD_M_MEDIA_FILE_DEBUG
|
||||
log::debug
|
||||
{
|
||||
log, "File %s read event_idx:%lu events[fetched:%zu prefetched:%zu] encoded:%zu decoded:%zu total_encoded:%zu total_decoded:%zu",
|
||||
string_view{room.room_id},
|
||||
it.event_idx(),
|
||||
events_fetched,
|
||||
events_prefetched,
|
||||
size(blk_encoded),
|
||||
size(blk),
|
||||
encoding_bytes,
|
||||
decoded_bytes,
|
||||
};
|
||||
#endif
|
||||
if constexpr(debug_read)
|
||||
log::debug
|
||||
{
|
||||
log, "File %s read event_idx:%lu events[fetched:%zu prefetched:%zu] encoded:%zu decoded:%zu total_encoded:%zu total_decoded:%zu",
|
||||
string_view{room.room_id},
|
||||
it.event_idx(),
|
||||
events_fetched,
|
||||
events_prefetched,
|
||||
size(blk_encoded),
|
||||
size(blk),
|
||||
encoding_bytes,
|
||||
decoded_bytes,
|
||||
};
|
||||
|
||||
assert(size(blk) == b64::decode_size(blk_encoded));
|
||||
|
||||
closure(blk);
|
||||
|
|
Loading…
Reference in a new issue