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

ircd::resource: Choose better log level based on HTTP response codes.

This commit is contained in:
Jason Volk 2018-04-23 17:47:10 -07:00
parent 48c38f4282
commit 7889d116f0

View file

@ -883,8 +883,22 @@ ircd::resource::response::response(client &client,
client.write_all(head.completed())
};
log::debug
#ifdef RB_DEBUG
const log::facility facility
{
ushort(code) >= 200 && ushort(code) < 300?
log::facility::DEBUG:
ushort(code) >= 300 && ushort(code) < 400?
log::facility::DWARNING:
ushort(code) >= 400 && ushort(code) < 500?
log::facility::DERROR:
log::facility::ERROR
};
log::logf
{
log::general, facility,
"socket(%p) local[%s] remote[%s] HTTP %d %s in %ld$us; %s %zd content",
client.sock.get(),
string(local(client)),
@ -895,6 +909,7 @@ ircd::resource::response::response(client &client,
content_type,
ssize_t(content_length),
};
#endif
assert(written == size(head.completed()));
}