mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:vm: Add loghead convenience.
This commit is contained in:
parent
a6a509fe4b
commit
507c256eb4
2 changed files with 26 additions and 0 deletions
|
@ -28,6 +28,9 @@ namespace ircd::m::vm
|
|||
|
||||
string_view reflect(const fault &);
|
||||
http::code http_code(const fault &);
|
||||
|
||||
string_view loghead(const mutable_buffer &, const eval &);
|
||||
string_view loghead(const eval &); // single tls buffer
|
||||
}
|
||||
|
||||
namespace ircd::m::vm::sequence
|
||||
|
|
23
ircd/m.cc
23
ircd/m.cc
|
@ -1052,6 +1052,29 @@ decltype(ircd::m::vm::default_copts)
|
|||
ircd::m::vm::default_copts
|
||||
{};
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::vm::loghead(const eval &eval)
|
||||
{
|
||||
thread_local char buf[128];
|
||||
return loghead(buf, eval);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::vm::loghead(const mutable_buffer &buf,
|
||||
const eval &eval)
|
||||
{
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "vm[%lu:%lu:%lu] eval[%lu] id:%lu txn:%p",
|
||||
sequence::uncommitted,
|
||||
sequence::committed,
|
||||
sequence::retired,
|
||||
sequence::get(eval),
|
||||
eval.id,
|
||||
(const void *)txn
|
||||
};
|
||||
}
|
||||
|
||||
ircd::http::code
|
||||
ircd::m::vm::http_code(const fault &code)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue