Mercurial > hg > orthanc
diff OrthancServer/Sources/main.cpp @ 4270:251a8b07fa37
logging categories
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Nov 2020 18:45:50 +0100 |
parents | 64f57c9d5f79 |
children | 0034f855c023 |
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp Mon Nov 02 17:15:57 2020 +0100 +++ b/OrthancServer/Sources/main.cpp Mon Nov 02 18:45:50 2020 +0100 @@ -1495,6 +1495,18 @@ } +static void SetLoggingCategories(Logging::LogLevel level, + const std::string& lst) +{ + std::vector<std::string> categories; + Toolbox::TokenizeString(categories, lst, ':'); + for (size_t i = 0; i < categories.size(); i++) + { + Logging::SetCategoryEnabled(level, Logging::StringToCategory(categories[i]), true); + } +} + + static bool DisplayPerformanceWarning() { (void) DisplayPerformanceWarning; // Disable warning about unused function @@ -1563,10 +1575,18 @@ { Logging::EnableTraceLevel(true); } + else if (boost::starts_with(argument, "--verbose=")) // New in Orthanc 1.8.1 + { + SetLoggingCategories(Logging::LogLevel_INFO, argument.substr(10)); + } + else if (boost::starts_with(argument, "--trace=")) // New in Orthanc 1.8.1 + { + SetLoggingCategories(Logging::LogLevel_TRACE, argument.substr(8)); + } else if (boost::starts_with(argument, "--logdir=")) { // TODO WHAT IS THE ENCODING? - std::string directory = argument.substr(9); + const std::string directory = argument.substr(9); try { @@ -1582,7 +1602,7 @@ else if (boost::starts_with(argument, "--logfile=")) { // TODO WHAT IS THE ENCODING? - std::string file = argument.substr(10); + const std::string file = argument.substr(10); try {