# HG changeset patch # User Alain Mazy # Date 1604573012 -3600 # Node ID 0923247e69f64caa7a5a3115e3f32c3d2efec86c # Parent 29729b7eb6ab946f959180be2101d5479ec0e657 log categories: rest -> http + added lua & jobs diff -r 29729b7eb6ab -r 0923247e69f6 OrthancFramework/Sources/HttpServer/HttpServer.cpp --- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -1088,7 +1088,7 @@ std::transform(name.begin(), name.end(), name.begin(), ::tolower); headers.insert(std::make_pair(name, value)); - CLOG(TRACE, REST) << "HTTP header: [" << name << "]: [" << value << "]"; + CLOG(TRACE, HTTP) << "HTTP header: [" << name << "]: [" << value << "]"; } if (server.IsHttpCompressionEnabled()) diff -r 29729b7eb6ab -r 0923247e69f6 OrthancFramework/Sources/Logging.cpp --- a/OrthancFramework/Sources/Logging.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancFramework/Sources/Logging.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -206,9 +206,9 @@ target = LogCategory_PLUGINS; return true; } - else if (category == "rest") + else if (category == "http") { - target = LogCategory_REST; + target = LogCategory_HTTP; return true; } else if (category == "dicom") @@ -221,6 +221,16 @@ target = LogCategory_SQLITE; return true; } + else if (category == "jobs") + { + target = LogCategory_JOBS; + return true; + } + else if (category == "lua") + { + target = LogCategory_LUA; + return true; + } else { return false; @@ -230,7 +240,7 @@ unsigned int GetCategoriesCount() { - return 5; + return 7; } @@ -257,8 +267,8 @@ case LogCategory_PLUGINS: return "plugins"; - case LogCategory_REST: - return "rest"; + case LogCategory_HTTP: + return "http"; case LogCategory_DICOM: return "dicom"; @@ -266,6 +276,12 @@ case LogCategory_SQLITE: return "sqlite"; + case LogCategory_JOBS: + return "jobs"; + + case LogCategory_LUA: + return "lua"; + default: throw OrthancException(ErrorCode_ParameterOutOfRange); } diff -r 29729b7eb6ab -r 0923247e69f6 OrthancFramework/Sources/Logging.h --- a/OrthancFramework/Sources/Logging.h Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancFramework/Sources/Logging.h Thu Nov 05 11:43:32 2020 +0100 @@ -62,9 +62,11 @@ { LogCategory_GENERIC = (1 << 0), LogCategory_PLUGINS = (1 << 1), - LogCategory_REST = (1 << 2), + LogCategory_HTTP = (1 << 2), LogCategory_SQLITE = (1 << 3), - LogCategory_DICOM = (1 << 4) + LogCategory_DICOM = (1 << 4), + LogCategory_JOBS = (1 << 5), + LogCategory_LUA = (1 << 6), }; ORTHANC_PUBLIC const char* EnumerationToString(LogLevel level); diff -r 29729b7eb6ab -r 0923247e69f6 OrthancFramework/UnitTestsSources/LoggingTests.cpp --- a/OrthancFramework/UnitTestsSources/LoggingTests.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancFramework/UnitTestsSources/LoggingTests.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -368,12 +368,14 @@ 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, "http")); ASSERT_EQ(Logging::LogCategory_HTTP, 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_TRUE(Logging::LookupCategory(c, "jobs")); ASSERT_EQ(Logging::LogCategory_JOBS, c); + ASSERT_TRUE(Logging::LookupCategory(c, "lua")); ASSERT_EQ(Logging::LogCategory_LUA, c); ASSERT_FALSE(Logging::LookupCategory(c, "nope")); - ASSERT_EQ(5u, Logging::GetCategoriesCount()); + ASSERT_EQ(7u, Logging::GetCategoriesCount()); std::set s; for (size_t i = 0; i < Logging::GetCategoriesCount(); i++) @@ -383,18 +385,22 @@ s.insert(Logging::GetCategoryName(i)); } - ASSERT_EQ(5u, s.size()); + ASSERT_EQ(7u, s.size()); ASSERT_TRUE(s.find("generic") != s.end()); ASSERT_TRUE(s.find("plugins") != s.end()); - ASSERT_TRUE(s.find("rest") != s.end()); + ASSERT_TRUE(s.find("http") != s.end()); ASSERT_TRUE(s.find("sqlite") != s.end()); ASSERT_TRUE(s.find("dicom") != s.end()); + ASSERT_TRUE(s.find("lua") != s.end()); + ASSERT_TRUE(s.find("jobs") != s.end()); ASSERT_THROW(Logging::GetCategoryName(Logging::GetCategoriesCount()), OrthancException); ASSERT_STREQ("generic", Logging::GetCategoryName(Logging::LogCategory_GENERIC)); ASSERT_STREQ("plugins", Logging::GetCategoryName(Logging::LogCategory_PLUGINS)); - ASSERT_STREQ("rest", Logging::GetCategoryName(Logging::LogCategory_REST)); + ASSERT_STREQ("http", Logging::GetCategoryName(Logging::LogCategory_HTTP)); ASSERT_STREQ("sqlite", Logging::GetCategoryName(Logging::LogCategory_SQLITE)); ASSERT_STREQ("dicom", Logging::GetCategoryName(Logging::LogCategory_DICOM)); + ASSERT_STREQ("lua", Logging::GetCategoryName(Logging::LogCategory_LUA)); + ASSERT_STREQ("jobs", Logging::GetCategoryName(Logging::LogCategory_JOBS)); } diff -r 29729b7eb6ab -r 0923247e69f6 OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -113,7 +113,7 @@ { ServerContext& context = OrthancRestApi::GetContext(call); - CLOG(INFO, REST) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; + CLOG(INFO, HTTP) << "Receiving a DICOM file of " << call.GetBodySize() << " bytes through HTTP"; if (call.GetBodySize() == 0) { diff -r 29729b7eb6ab -r 0923247e69f6 OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -1587,7 +1587,7 @@ for (size_t j = 0; j < orthancId.size(); j++) { - CLOG(INFO, REST) << "Storage commitment - Removing SOP instance UID / Orthanc ID: " + CLOG(INFO, HTTP) << "Storage commitment - Removing SOP instance UID / Orthanc ID: " << sopInstanceUids[i] << " / " << orthancId[j]; Json::Value tmp; diff -r 29729b7eb6ab -r 0923247e69f6 OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Thu Nov 05 11:23:47 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Thu Nov 05 11:43:32 2020 +0100 @@ -1351,12 +1351,12 @@ if (ok) { - CLOG(INFO, REST) << "The attachment " << name << " of resource " << publicId << " has the right MD5"; + CLOG(INFO, HTTP) << "The attachment " << name << " of resource " << publicId << " has the right MD5"; call.GetOutput().AnswerBuffer("{}", MimeType_Json); } else { - CLOG(INFO, REST) << "The attachment " << name << " of resource " << publicId << " has bad MD5!"; + CLOG(INFO, HTTP) << "The attachment " << name << " of resource " << publicId << " has bad MD5!"; } }