Skip to content
Snippets Groups Projects
Commit 12d82bb5 authored by Jaswant Panchumarti (Kitware)'s avatar Jaswant Panchumarti (Kitware)
Browse files

Do not overwrite loguru global stderr verbosity

- This fixes a bug when applications completely rely on
  vtkLogger::Init(ac, av) to parse the -v flag on CLI and
  set the stderr verbosity.
- With this commit, it is finally possible to run the test
  executables with a custom verbosity by merely passing -v <verbosity>
  on the command line. This greatly simplifies debugging trace messages
  without having to manually set the stderr verbosity and recompile the
  test executable.
parent ab7468ee
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,6 @@ void vtkLogger::Init(int& argc, char* argv[], const char* verbosity_flag /*= "-v
loguru::g_preamble_time = false;
loguru::g_internal_verbosity = static_cast<loguru::Verbosity>(vtkLogger::InternalVerbosityLevel);
const auto current_stderr_verbosity = loguru::g_stderr_verbosity;
if (loguru::g_internal_verbosity > loguru::g_stderr_verbosity)
{
// this avoids printing the preamble-header on stderr except for cases
......@@ -156,8 +155,8 @@ void vtkLogger::Init(int& argc, char* argv[], const char* verbosity_flag /*= "-v
{
options.main_thread_name = detail::ThreadName;
}
loguru::init(argc, argv, options);
loguru::g_stderr_verbosity = current_stderr_verbosity;
loguru::init(
argc, argv, options); // initializes many things, one of them being g_stderr_verbosity
#else
(void)argc;
(void)argv;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment