mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 11:23:45 +02:00
modules/federation/send: Add m.txn log facility; improve debuglog related.
This commit is contained in:
parent
2aa169695a
commit
ced3df67c6
|
@ -16,6 +16,12 @@ IRCD_MODULE
|
||||||
"federation send"
|
"federation send"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log::log
|
||||||
|
txn_log
|
||||||
|
{
|
||||||
|
"m.txn"
|
||||||
|
};
|
||||||
|
|
||||||
m::resource
|
m::resource
|
||||||
send_resource
|
send_resource
|
||||||
{
|
{
|
||||||
|
@ -147,7 +153,7 @@ catch(const m::vm::error &e)
|
||||||
|
|
||||||
log::error
|
log::error
|
||||||
{
|
{
|
||||||
m::log, "Unhandled error processing txn '%s' from '%s' :%s :%s :%s",
|
txn_log, "Unhandled error processing txn '%s' from '%s' :%s :%s :%s",
|
||||||
txn_id,
|
txn_id,
|
||||||
request.node_id,
|
request.node_id,
|
||||||
e.what(),
|
e.what(),
|
||||||
|
@ -161,7 +167,7 @@ catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
log::error
|
log::error
|
||||||
{
|
{
|
||||||
m::log, "Unhandled error processing txn '%s' from '%s' :%s",
|
txn_log, "Unhandled error processing txn '%s' from '%s' :%s",
|
||||||
txn_id,
|
txn_id,
|
||||||
request.node_id,
|
request.node_id,
|
||||||
e.what(),
|
e.what(),
|
||||||
|
@ -191,17 +197,6 @@ handle_put(client &client,
|
||||||
json::at<"origin"_>(request)
|
json::at<"origin"_>(request)
|
||||||
};
|
};
|
||||||
|
|
||||||
char rembuf[64];
|
|
||||||
log::debug
|
|
||||||
{
|
|
||||||
m::log, "%s :%s | %s --> edus:%zu pdus:%zu",
|
|
||||||
txn_id,
|
|
||||||
origin,
|
|
||||||
string(rembuf, remote(client)),
|
|
||||||
json::get<"edus"_>(request).count(),
|
|
||||||
json::get<"pdus"_>(request).count(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if(origin && origin != request.node_id)
|
if(origin && origin != request.node_id)
|
||||||
throw m::ACCESS_DENIED
|
throw m::ACCESS_DENIED
|
||||||
{
|
{
|
||||||
|
@ -255,6 +250,21 @@ handle_put(client &client,
|
||||||
client, http::ACCEPTED
|
client, http::ACCEPTED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
char rembuf[96];
|
||||||
|
log::logf
|
||||||
|
{
|
||||||
|
txn_log, log::level::DEBUG,
|
||||||
|
"%s %zu$B pdu:%zu %zu$B edu:%zu %zu %s :%s",
|
||||||
|
txn_id,
|
||||||
|
size(string_view(json::get<"pdus"_>(request))),
|
||||||
|
json::get<"pdus"_>(request).count(),
|
||||||
|
size(string_view(json::get<"edus"_>(request))),
|
||||||
|
json::get<"edus"_>(request).count(),
|
||||||
|
evals,
|
||||||
|
string(rembuf, remote(client)),
|
||||||
|
origin,
|
||||||
|
};
|
||||||
|
|
||||||
char chunk[1536];
|
char chunk[1536];
|
||||||
m::resource::response::chunked response
|
m::resource::response::chunked response
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue