Skip to content

Commit

Permalink
Add comments to note about possible problems
Browse files Browse the repository at this point in the history
  • Loading branch information
geier1993 committed Sep 11, 2024
1 parent 86ec904 commit 8caa48e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/eckit/log/Log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ Channel& Log::info() {
}

if (Main::finalised()) {
// This may still cause a SEGFAULT due to missing destruction order at the end of library life time
// - only solution is then to use an empty channel which is harmless in a destructed state
thread_local Channel postMainInfo(new PrefixTarget("POST-MAIN-INFO", new OStreamTarget(std::cout)));
return postMainInfo;
}
Expand All @@ -142,6 +144,8 @@ Channel& Log::error() {
}

if (Main::finalised()) {
// This may still cause a SEGFAULT due to missing destruction order at the end of library life time
// - only solution is then to use an empty channel which is harmless in a destructed state
thread_local Channel postMainError(new PrefixTarget("POST-MAIN-ERROR", new OStreamTarget(std::cout)));
return postMainError;
}
Expand All @@ -157,6 +161,8 @@ Channel& Log::warning() {
}

if (Main::finalised()) {
// This may still cause a SEGFAULT due to missing destruction order at the end of library life time
// - only solution is then to use an empty channel which is harmless in a destructed state
thread_local Channel postMainWarning(new PrefixTarget("POST-MAIN-WARNING", new OStreamTarget(std::cout)));
return postMainWarning;
}
Expand All @@ -177,6 +183,8 @@ Channel& Log::debug() {
if (!Main::instance().debug_) { return emptyChannel_; }

if (Main::finalised()) {
// This may still cause a SEGFAULT due to missing destruction order at the end of library life time
// - only solution is then to use an empty channel which is harmless in a destructed state
thread_local Channel postMainDebug(new PrefixTarget("POST-MAIN-DEBUG", new OStreamTarget(std::cout)));
return postMainDebug;
}
Expand Down

0 comments on commit 8caa48e

Please sign in to comment.