-
Notifications
You must be signed in to change notification settings - Fork 163
Logging improvements #2646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Logging improvements #2646
Conversation
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).
|
CI gfxreconstruct build queued with queue ID 638025. |
|
CI gfxreconstruct build # 8764 running. |
|
CI gfxreconstruct build # 8764 passed. |
|
CI gfxreconstruct build queued with queue ID 638072. |
|
CI gfxreconstruct build # 8766 running. |
|
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); |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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;
These changes pave the way for improved logging:
NOTE: This is squashed because it was already pre-approved in another workflow (sorry for the large chunk).