Add parameter-less InitLogging().
Also document that this function should only be called from a single thread.
This commit is contained in:
parent
16c4dde2ee
commit
be0db4b021
@ -129,6 +129,14 @@ void InitLogging(int& argc, char* argv[])
|
||||
#endif // VTKM_ENABLE_LOGGING
|
||||
}
|
||||
|
||||
void InitLogging()
|
||||
{
|
||||
int argc = 1;
|
||||
char dummy[1] = { '\0' };
|
||||
char* argv[2] = { dummy, nullptr };
|
||||
InitLogging(argc, argv);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void SetStderrLogLevel(LogLevel level)
|
||||
{
|
||||
|
@ -321,10 +321,21 @@ enum class LogLevel
|
||||
* Initializes logging. Sets up custom log level and thread names. Parses any
|
||||
* "-v [LogLevel]" arguments to set the stderr log level. This argument may
|
||||
* be either numeric, or the 4-character string printed in the output.
|
||||
*
|
||||
* If the parameterless overload is used, the `-v` parsing is not used, but
|
||||
* other functionality should still work.
|
||||
*
|
||||
* @note This function is not threadsafe and should only be called from a single
|
||||
* thread (ideally the main thread).
|
||||
* @{
|
||||
*/
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT
|
||||
void InitLogging(int& argc, char* argv[]);
|
||||
VTKM_CONT_EXPORT
|
||||
VTKM_CONT
|
||||
void InitLogging();
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* Set the range of log levels that will be printed to stderr. All levels
|
||||
|
@ -82,12 +82,11 @@ void RunTests()
|
||||
|
||||
} // end anon namespace
|
||||
|
||||
int UnitTestLogging(int argc, char* argv[])
|
||||
int UnitTestLogging(int, char* [])
|
||||
{
|
||||
vtkm::cont::InitLogging(argc, argv);
|
||||
vtkm::cont::SetLogThreadName("main thread");
|
||||
// Test that parameterless init works:
|
||||
vtkm::cont::InitLogging();
|
||||
|
||||
// return vtkm::cont::testing::Testing::Run(RunTests);
|
||||
RunTests();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user