From 419b0ec46997f74c806b18a1ca4c6951f305ae2f Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Sun, 6 Mar 2016 20:40:31 +0100 Subject: [PATCH] Making sure log is written in case of exception --- src/logging.cpp | 4 ++++ src/logging.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/logging.cpp b/src/logging.cpp index e09c3fd..cf521fa 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -24,6 +24,10 @@ string toString(LogLevel level) { PausableBackendAdapter::PausableBackendAdapter(boost::shared_ptr backend) : backend(backend) {} +PausableBackendAdapter::~PausableBackendAdapter() { + resume(); +} + void PausableBackendAdapter::consume(const record_view& recordView, const string message) { lock_guard lock(mutex); if (isPaused) { diff --git a/src/logging.h b/src/logging.h index 03f2b83..cc717c8 100644 --- a/src/logging.h +++ b/src/logging.h @@ -46,6 +46,7 @@ class PausableBackendAdapter : { public: PausableBackendAdapter(boost::shared_ptr backend); + ~PausableBackendAdapter(); void consume(const boost::log::record_view& recordView, const std::string message); void pause(); void resume();