diff options
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/logging/rotatingfilesink.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/zenutil/include/zenutil/logging/rotatingfilesink.h b/src/zenutil/include/zenutil/logging/rotatingfilesink.h index 5c6c655b8..4d10f3794 100644 --- a/src/zenutil/include/zenutil/logging/rotatingfilesink.h +++ b/src/zenutil/include/zenutil/logging/rotatingfilesink.h @@ -114,6 +114,11 @@ public: } virtual void flush() override { + if (!m_NeedFlush) + { + return; + } + ZEN_MEMSCOPE(ELLMTag::Logging); try @@ -128,6 +133,8 @@ public: { // Silently eat errors } + + m_NeedFlush = false; } virtual void set_pattern(const std::string& pattern) override @@ -204,6 +211,7 @@ private: { return false; } + m_NeedFlush = true; return true; } @@ -229,6 +237,7 @@ private: { return false; } + m_NeedFlush = true; return true; } @@ -239,6 +248,7 @@ private: const std::size_t m_MaxSize; const std::size_t m_MaxFiles; BasicFile m_CurrentFile; + bool m_NeedFlush = false; }; } // namespace zen::logging |