diff options
| author | Stefan Boberg <[email protected]> | 2025-11-24 11:05:29 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-11-24 11:05:29 +0100 |
| commit | e5eccea44a3e6a80d3b24ad2113bfeea86c62827 (patch) | |
| tree | baad4e4a7ab43079e08e0842a67d16f6d5eb6404 /src/zenutil/include | |
| parent | add Deploy.md and ability to specify a version via --version (#663) (diff) | |
| download | zen-e5eccea44a3e6a80d3b24ad2113bfeea86c62827.tar.xz zen-e5eccea44a3e6a80d3b24ad2113bfeea86c62827.zip | |
logging improvements (#664)
* Eliminate spurious `FlushFileBuffers` calls on Windows by tracking writes
* Make cache log file creation optional
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 |