Skip to content

Conversation

@MarkY-LunarG
Copy link
Contributor

These changes pave the way for improved logging:

  • Logging to multiple locations simultaneously
  • Each logging target can have it's own logging level eventually
  • New logging targets can easily be added
  • Improved initialization and destruction (now using a singleton with unique_ptr usage).

NOTE: This is squashed because it was already pre-approved in another workflow (sorry for the large chunk).

Update the logging to use a logging manager singleton.
It also keeps the generation of all logging messages in
one location, but distributes the output control to
individual targets that controls how content is displayed
(file, stdout, stderr, etc).
These changes alos remove the need to delete and re-initialize the
logging during start-up.
Additionally, this will allow us to fine-tune control of each
individual output to have different severities (should we desire).
@MarkY-LunarG MarkY-LunarG requested a review from a team as a code owner February 2, 2026 16:22
@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 638025.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8764 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8764 passed.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build queued with queue ID 638072.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8766 running.

@ci-tester-lunarg
Copy link
Collaborator

CI gfxreconstruct build # 8766 failed.

{
// setting this to kDebugSeverity yields debug-output from parser
gfxrecon::util::Log::Init(gfxrecon::util::Log::kErrorSeverity);
gfxrecon::util::Log::Init(gfxrecon::util::LoggingSeverity::kDebug);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not required here, same above w. kInfo. makes the unit-test quite verbose since SpirVParsingUtil uses GFXRECON_LOG_DEBUG to print a summary

GFXRECON_BEGIN_NAMESPACE(gfxrecon)
GFXRECON_BEGIN_NAMESPACE(util)

const char g_process_tag[] = "gfxrecon";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr char g_process_tag[] = "gfxrecon"; should also work

return true;
}

bool LoggingManager::UpdateStdErrTarget(bool write_to_stderr, bool flush_after_write)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdateStdErrTarget always returns true. should it rather return if state actually got changed?

like:

bool was_using_stderr = logging_targets_[kTarget_StdErr] && logging_targets_[kTarget_StdErr]->IsEnabled(); // LoggingTargetBase::IsEnabled() does not exist, but would be useful
...
return write_to_stderr != was_using_stderr;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants