Mercurial > hg > orthanc
diff OrthancServer/UnitTestsSources/UnitTestsMain.cpp @ 4273:0034f855c023
tuning log categories from command-line, and binary compat with orthanc framework 1.7.2
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 03 Nov 2020 12:24:50 +0100 |
parents | f0d81320f17f |
children | d7a50b7b8466 |
line wrap: on
line diff
--- a/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Tue Nov 03 07:19:33 2020 +0100 +++ b/OrthancServer/UnitTestsSources/UnitTestsMain.cpp Tue Nov 03 12:24:50 2020 +0100 @@ -126,6 +126,29 @@ ASSERT_STREQ("Generic", EnumerationToString(StringToModalityManufacturer("Dcm4Chee"))); ASSERT_STREQ("GenericNoWildcardInDates", EnumerationToString(StringToModalityManufacturer("SyngoVia"))); ASSERT_STREQ("GenericNoWildcardInDates", EnumerationToString(StringToModalityManufacturer("AgfaImpax"))); + + ASSERT_STREQ("default", EnumerationToString(StringToVerbosity("default"))); + ASSERT_STREQ("verbose", EnumerationToString(StringToVerbosity("verbose"))); + ASSERT_STREQ("trace", EnumerationToString(StringToVerbosity("trace"))); + ASSERT_THROW(StringToVerbosity("nope"), OrthancException); + + Logging::LogCategory c; + ASSERT_TRUE(Logging::LookupCategory(c, "generic")); ASSERT_EQ(Logging::LogCategory_GENERIC, c); + ASSERT_TRUE(Logging::LookupCategory(c, "plugins")); ASSERT_EQ(Logging::LogCategory_PLUGINS, c); + ASSERT_TRUE(Logging::LookupCategory(c, "rest")); ASSERT_EQ(Logging::LogCategory_REST, c); + ASSERT_TRUE(Logging::LookupCategory(c, "sqlite")); ASSERT_EQ(Logging::LogCategory_SQLITE, c); + ASSERT_TRUE(Logging::LookupCategory(c, "dicom")); ASSERT_EQ(Logging::LogCategory_DICOM, c); + ASSERT_FALSE(Logging::LookupCategory(c, "nope")); + + ASSERT_EQ(5u, Logging::GetCategoriesCount()); + + for (size_t i = 0; i < Logging::GetCategoriesCount(); i++) + { + Logging::LogCategory c; + ASSERT_TRUE(Logging::LookupCategory(c, Logging::GetCategoryName(i))); + } + + ASSERT_THROW(Logging::GetCategoryName(Logging::GetCategoriesCount()), OrthancException); } @@ -509,7 +532,7 @@ { Logging::Initialize(); Toolbox::InitializeGlobalLocale(NULL); - Logging::EnableInfoLevel(true); + SetGlobalVerbosity(Verbosity_Verbose); Toolbox::DetectEndianness(); SystemToolbox::MakeDirectory("UnitTestsResults"); OrthancInitialize();