[FarGroup/FarManager] master: Suppress logs once the logger is destroyed (fac5529f2)

0 views
Skip to first unread message

farg...@farmanager.com

unread,
Oct 3, 2022, 6:30:49 PM10/3/22
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/fac5529f230d22a71384e1c2e04698dceb609a34

>---------------------------------------------------------------

commit fac5529f230d22a71384e1c2e04698dceb609a34
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Mon Oct 3 23:23:56 2022 +0100

Suppress logs once the logger is destroyed


>---------------------------------------------------------------

fac5529f230d22a71384e1c2e04698dceb609a34
far/log.cpp | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/far/log.cpp b/far/log.cpp
index 06c7c396f..b093f4649 100644
--- a/far/log.cpp
+++ b/far/log.cpp
@@ -666,6 +666,11 @@ namespace logging

engine() = default;

+ ~engine()
+ {
+ s_Destroyed = true;
+ }
+
void configure(string_view const Parameters)
{
initialise();
@@ -687,6 +692,9 @@ namespace logging
[[nodiscard]]
bool filter(level const Level)
{
+ if (s_Destroyed)
+ return false;
+
switch (m_Status)
{
case engine_status::incomplete:
@@ -856,6 +864,7 @@ namespace logging
level m_TraceLevel{ level::fatal };
size_t m_TraceDepth{ std::numeric_limits<size_t>::max() };
std::atomic<engine_status> m_Status{ engine_status::incomplete };
+ static inline bool s_Destroyed;
};

bool filter(level const Level)


Reply all
Reply to author
Forward
0 new messages