mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::server: Add additional loghead(link, request) with more data.
This commit is contained in:
parent
4f27526e9b
commit
3865326d71
2 changed files with 37 additions and 1 deletions
|
@ -24,9 +24,13 @@ namespace ircd::server
|
|||
// gets the unique tag number from request or 0 if no tag associated.
|
||||
uint64_t id(const request &);
|
||||
|
||||
// convenience suite used to prefix log messages.
|
||||
string_view loghead(const mutable_buffer &out, const request &);
|
||||
string_view loghead(const request &);
|
||||
string_view loghead(const mutable_buffer &out, const link &, const request &);
|
||||
string_view loghead(const link &, const request &);
|
||||
|
||||
// control panel
|
||||
void submit(const hostport &, request &);
|
||||
bool cancel(request &);
|
||||
}
|
||||
|
|
|
@ -375,6 +375,35 @@ ircd::server::submit(const hostport &hostport,
|
|||
peer.submit(request);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::server::loghead(const link &link,
|
||||
const request &request)
|
||||
{
|
||||
thread_local char buf[256];
|
||||
return loghead(buf, link, request);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::server::loghead(const mutable_buffer &buf,
|
||||
const link &link,
|
||||
const request &request)
|
||||
{
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "peer[%lu] link[%lu] %s",
|
||||
link.peer? link.peer->id : 0UL,
|
||||
link.id,
|
||||
loghead(request)
|
||||
};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::server::loghead(const request &request)
|
||||
{
|
||||
thread_local char buf[256];
|
||||
return loghead(buf, request);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::server::loghead(const mutable_buffer &buf,
|
||||
const request &request)
|
||||
|
@ -396,7 +425,10 @@ try
|
|||
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "%s %s", head.method, head.path
|
||||
buf, "tag[%lu] %s %s",
|
||||
id(request),
|
||||
head.method,
|
||||
head.path
|
||||
};
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
|
|
Loading…
Reference in a new issue