Making sure log is written in case of exception

This commit is contained in:
Daniel Wolf 2016-03-06 20:40:31 +01:00
parent 933f324943
commit 419b0ec469
2 changed files with 5 additions and 0 deletions

View File

@ -24,6 +24,10 @@ string toString(LogLevel level) {
PausableBackendAdapter::PausableBackendAdapter(boost::shared_ptr<text_ostream_backend> backend) :
backend(backend) {}
PausableBackendAdapter::~PausableBackendAdapter() {
resume();
}
void PausableBackendAdapter::consume(const record_view& recordView, const string message) {
lock_guard<std::mutex> lock(mutex);
if (isPaused) {

View File

@ -46,6 +46,7 @@ class PausableBackendAdapter :
{
public:
PausableBackendAdapter(boost::shared_ptr<boost::log::sinks::text_ostream_backend> backend);
~PausableBackendAdapter();
void consume(const boost::log::record_view& recordView, const std::string message);
void pause();
void resume();