0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-16 08:58:20 +02:00

ircd::log: Make sure the stream is flushed and reset when relinquishing control.

This commit is contained in:
Jason Volk 2017-10-19 01:38:25 -07:00
parent 43e35786ce
commit b83d7da7a0
2 changed files with 14 additions and 2 deletions

View file

@ -184,8 +184,14 @@ catch(const std::exception &e)
std::cout << "***\n";
std::cout << "*** The console session has ended: " << e.what() << "\n";
std::cout << "***" << std::endl;
std::cout << std::flush;
std::cout.clear();
std::cerr << std::flush;
std::cerr.clear();
ircd::log::debug("The console session has ended: %s", e.what());
return;
}
bool

View file

@ -207,6 +207,12 @@ ircd::log::console_quiet::~console_quiet()
{
std::copy(begin(quieted_out), end(quieted_out), begin(console_out));
std::copy(begin(quieted_err), end(quieted_err), begin(console_err));
std::cout << std::flush;
std::cout.clear();
std::cerr << std::flush;
std::cerr.clear();
}
ircd::log::log::log(const std::string &name)
@ -406,7 +412,7 @@ ircd::log::suffix(const facility &fac)
if(console_flush[fac] || std::current_exception())
{
std::flush(stream);
stream << std::flush;
assert(stream.good());
}
});