mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 20:28:52 +02:00
ircd::log: Log critical messages to all outputs and ignore all masks.
This commit is contained in:
parent
23b8874dc8
commit
ab121835af
1 changed files with 24 additions and 6 deletions
|
@ -481,15 +481,31 @@ noexcept
|
||||||
s.write(data(msg), size(msg));
|
s.write(data(msg), size(msg));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// copy to std::cerr
|
const bool copy_to_stderr
|
||||||
if(log.cmasked && bool(conf.console_stderr) && !console_quiet_stderr[lev])
|
{
|
||||||
|
bool(conf.console_stderr)
|
||||||
|
&& ((!console_quiet_stderr[lev] && log.cmasked) || lev == level::CRITICAL)
|
||||||
|
};
|
||||||
|
|
||||||
|
const bool copy_to_stdout
|
||||||
|
{
|
||||||
|
bool(conf.console_stdout)
|
||||||
|
&& ((!console_quiet_stdout[lev] && log.cmasked) || lev == level::CRITICAL)
|
||||||
|
};
|
||||||
|
|
||||||
|
const bool copy_to_file
|
||||||
|
{
|
||||||
|
file[lev].is_open()
|
||||||
|
&& (log.fmasked || lev == level::CRITICAL)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(copy_to_stderr)
|
||||||
{
|
{
|
||||||
err_console.clear();
|
err_console.clear();
|
||||||
write(err_console);
|
write(err_console);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to std::cout
|
if(copy_to_stdout)
|
||||||
if(log.cmasked && bool(conf.console_stdout) && !console_quiet_stdout[lev])
|
|
||||||
{
|
{
|
||||||
out_console.clear();
|
out_console.clear();
|
||||||
write(out_console);
|
write(out_console);
|
||||||
|
@ -497,8 +513,7 @@ noexcept
|
||||||
std::flush(out_console);
|
std::flush(out_console);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy to file
|
if(copy_to_file)
|
||||||
if(log.fmasked && file[lev].is_open())
|
|
||||||
{
|
{
|
||||||
file[lev].clear();
|
file[lev].clear();
|
||||||
write(file[lev]);
|
write(file[lev]);
|
||||||
|
@ -511,6 +526,9 @@ bool
|
||||||
ircd::log::can_skip(const log &log,
|
ircd::log::can_skip(const log &log,
|
||||||
const level &lev)
|
const level &lev)
|
||||||
{
|
{
|
||||||
|
if(unlikely(lev == level::CRITICAL))
|
||||||
|
return false;
|
||||||
|
|
||||||
const auto &conf(confs.at(lev));
|
const auto &conf(confs.at(lev));
|
||||||
|
|
||||||
// When all of these conditions are true there is no possible log output
|
// When all of these conditions are true there is no possible log output
|
||||||
|
|
Loading…
Reference in a new issue