remove static var, directly init logging to INFO level for testing inside Run Function

This commit is contained in:
nadavi 2019-09-04 13:51:51 -06:00
parent 374989fc2c
commit a0b164b42c
4 changed files with 4 additions and 15 deletions

@ -103,14 +103,9 @@ function(vtkm_unit_tests)
set(extraArgs EXTRA_INCLUDE "vtkm/cont/testing/Testing.h"
FUNCTION "vtkm::cont::testing::Environment env")
else()
set(extraArgs EXTRA_INCLUDE "vtkm/cont/Logging.h")
set(extraArgs)
endif()
# Logging is turned on by default now to Warning levels
# To get tests to correctly output info level logs we need to set
# the StderrLogLevel
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "vtkm::cont::SetStderrLogLevel(vtkm::cont::LogLevel::Info);")
#the creation of the test source list needs to occur before the labeling as
#cuda. This is so that we get the correctly named entry points generated
create_test_sourcelist(test_sources ${test_prog}.cxx ${VTKm_UT_SOURCES} ${extraArgs})

@ -103,10 +103,6 @@ namespace vtkm
namespace cont
{
#ifdef VTKM_ENABLE_LOGGING
static bool logSet = false;
#endif // VTKM_ENABLE_LOGGING
VTKM_CONT
void InitLogging(int& argc, char* argv[])
{
@ -129,10 +125,7 @@ void InitLogging(int& argc, char* argv[])
// Only set the default verbosity level if we won't overwrite
// a log level set by SetStderrLogLevel before InitLogging
if (!logSet)
{
SetStderrLogLevel(vtkm::cont::LogLevel::Warn);
}
SetStderrLogLevel(vtkm::cont::LogLevel::Warn);
loguru::init(argc, argv);
LOG_F(INFO, "Logging initialized.");
@ -158,7 +151,6 @@ void SetStderrLogLevel(LogLevel level)
{
#ifdef VTKM_ENABLE_LOGGING
loguru::g_stderr_verbosity = static_cast<loguru::Verbosity>(level);
logSet = true;
#else // VTKM_ENABLE_LOGGING
(void)level;
#endif // VTKM_ENABLE_LOGGING

@ -39,6 +39,7 @@ public:
static VTKM_CONT int Run(Func function, int argc, char* argv[])
{
vtkm::cont::Initialize(argc, argv);
vtkm::cont::SetStderrLogLevel(vtkm::cont::LogLevel::Info);
try
{

@ -318,6 +318,7 @@ public:
{
vtkm::cont::InitLogging(argc, argv);
vtkm::cont::SetStderrLogLevel(vtkm::cont::LogLevel::Info);
try
{