# HG changeset patch # User Sebastien Jodogne # Date 1604568245 -3600 # Node ID 6dcadbf1a8afe6745edb513ca2a908bd5db1a87c # Parent 7e05ad57d7a171ab7c810cceeebad7dc0d06044e prefixing log messages with their category diff -r 7e05ad57d7a1 -r 6dcadbf1a8af OrthancFramework/Sources/Logging.cpp --- a/OrthancFramework/Sources/Logging.cpp Thu Nov 05 09:57:35 2020 +0100 +++ b/OrthancFramework/Sources/Logging.cpp Thu Nov 05 10:24:05 2020 +0100 @@ -596,7 +596,8 @@ static void GetLinePrefix(std::string& prefix, LogLevel level, const char* file, - int line) + int line, + LogCategory category) { boost::filesystem::path path(file); boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time(); @@ -659,6 +660,11 @@ prefix = (std::string(date) + path.filename().string() + ":" + boost::lexical_cast(line) + "] "); + + if (category != LogCategory_GENERIC) + { + prefix += "(" + std::string(GetCategoryName(category)) + ") "; + } } @@ -791,7 +797,7 @@ } std::string prefix; - GetLinePrefix(prefix, level_, file, line); + GetLinePrefix(prefix, level_, file, line, category); { // We lock the global mutex. The mutex is locked until the