Mercurial > hg > orthanc
changeset 4292:6dcadbf1a8af
prefixing log messages with their category
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Nov 2020 10:24:05 +0100 |
parents | 7e05ad57d7a1 |
children | 29729b7eb6ab |
files | OrthancFramework/Sources/Logging.cpp |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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<std::string>(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