0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️:media: Log file room write errors and debug at completion.

This commit is contained in:
Jason Volk 2022-07-13 12:17:29 -07:00
parent 084bef0579
commit 45a4c80e79

View file

@ -213,6 +213,7 @@ ircd::m::media::file::write(const m::room &room,
const m::user::id &user_id,
const const_buffer &content,
const string_view &content_type)
try
{
static const size_t BLK_SZ
{
@ -277,10 +278,36 @@ ircd::m::media::file::write(const m::room &room,
wrote += size(blk);
}
log::logf
{
log, log::level::DEBUG,
"File written %s by %s type:%s len:%zu pos:%zu wrote:%zu",
string_view{room.room_id},
string_view{user_id},
content_type,
size(content),
off,
wrote,
};
//assert(wrote == b64::encode_size(off));
assert(off == size(content));
return off;
}
catch(const std::exception &e)
{
log::error
{
log, "File writing %s by %s type:%s len:%zu :%s",
string_view{room.room_id},
string_view{user_id},
content_type,
size(content),
e.what(),
};
throw;
}
size_t
ircd::m::media::file::read(const m::room &room,