mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd::resource: Add snomask'ed log facility.
This commit is contained in:
parent
dacbbbb051
commit
6f2c9631a1
2 changed files with 24 additions and 7 deletions
|
@ -29,6 +29,7 @@ struct ircd::resource
|
||||||
struct request;
|
struct request;
|
||||||
struct response;
|
struct response;
|
||||||
|
|
||||||
|
static log::log log;
|
||||||
static std::map<string_view, resource *, iless> resources;
|
static std::map<string_view, resource *, iless> resources;
|
||||||
|
|
||||||
string_view path;
|
string_view path;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
// copyright notice and this permission notice is present in all copies. The
|
// copyright notice and this permission notice is present in all copies. The
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
|
decltype(ircd::resource::log)
|
||||||
|
ircd::resource::log
|
||||||
|
{
|
||||||
|
"resource", 'r'
|
||||||
|
};
|
||||||
|
|
||||||
decltype(ircd::resource::resources)
|
decltype(ircd::resource::resources)
|
||||||
ircd::resource::resources
|
ircd::resource::resources
|
||||||
{};
|
{};
|
||||||
|
@ -129,7 +135,10 @@ ircd::resource::resource(const string_view &path,
|
||||||
{
|
{
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
"Registered resource \"%s\"", path.empty()? string_view{"/"} : this->path
|
log, "Registered resource \"%s\"",
|
||||||
|
path.empty()?
|
||||||
|
string_view{"/"}:
|
||||||
|
this->path
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +147,10 @@ noexcept
|
||||||
{
|
{
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
"Unregistered resource \"%s\"", path.empty()? string_view{"/"} : path
|
log, "Unregistered resource \"%s\"",
|
||||||
|
path.empty()?
|
||||||
|
string_view{"/"}:
|
||||||
|
path
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +299,7 @@ catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
log::derror
|
log::derror
|
||||||
{
|
{
|
||||||
"X-Matrix Authorization from %s: %s",
|
resource::log, "X-Matrix Authorization from %s: %s",
|
||||||
string(remote(client)),
|
string(remote(client)),
|
||||||
e.what()
|
e.what()
|
||||||
};
|
};
|
||||||
|
@ -330,7 +342,9 @@ catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
log::derror
|
log::derror
|
||||||
{
|
{
|
||||||
"Cache warming for '%s' :%s", origin, e.what()
|
resource::log, "Cache warming for '%s' :%s",
|
||||||
|
origin,
|
||||||
|
e.what()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +395,7 @@ ircd::resource::operator()(client &client,
|
||||||
|
|
||||||
log::derror
|
log::derror
|
||||||
{
|
{
|
||||||
"%s Timed out in %s `%s'",
|
log, "%s Timed out in %s `%s'",
|
||||||
client.loghead(),
|
client.loghead(),
|
||||||
head.method,
|
head.method,
|
||||||
head.path
|
head.path
|
||||||
|
@ -1057,14 +1071,16 @@ ircd::resource::response::response(client &client,
|
||||||
|
|
||||||
log::logf
|
log::logf
|
||||||
{
|
{
|
||||||
log::general, facility,
|
log, facility,
|
||||||
"%s HTTP %d %s in %ld$us; %s %s content",
|
"%s HTTP %d %s in %ld$us; %s %s content",
|
||||||
client.loghead(),
|
client.loghead(),
|
||||||
uint(code),
|
uint(code),
|
||||||
http::status(code),
|
http::status(code),
|
||||||
request_time,
|
request_time,
|
||||||
content_type,
|
content_type,
|
||||||
ssize_t(content_length) >= 0? lex_cast(content_length): "chunked"_sv
|
ssize_t(content_length) >= 0?
|
||||||
|
lex_cast(content_length):
|
||||||
|
"chunked"_sv
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue