Set module name in json

Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
JCW
2025-09-02 22:17:01 +01:00
parent 01a4416219
commit e401dcb2f1
2 changed files with 5 additions and 1 deletions

View File

@@ -337,6 +337,7 @@ public:
reset(
std::source_location location,
severities::Severity severity,
std::string_view moduleName,
std::string_view journalAttributesJson) noexcept;
};

View File

@@ -125,6 +125,7 @@ void
Journal::JsonLogContext::reset(
std::source_location location,
severities::Severity severity,
std::string_view moduleName,
std::string_view journalAttributesJson) noexcept
{
struct ThreadIdStringInitializer
@@ -161,6 +162,8 @@ Journal::JsonLogContext::reset(
}
}
writer().writeKey("ModuleName");
writer().writeString(moduleName);
writer().writeKey("MessageParams");
writer().startObject();
@@ -191,7 +194,7 @@ Journal::initMessageContext(
std::source_location location,
severities::Severity severity) const
{
currentJsonLogContext_.reset(location, severity, m_attributesJson);
currentJsonLogContext_.reset(location, severity, m_name, m_attributesJson);
}
std::string_view