aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-12-02 12:21:53 +0100
committerGitHub Enterprise <[email protected]>2024-12-02 12:21:53 +0100
commite6f44577f469e891ed8dab1492a4c53224e0b765 (patch)
tree47334606ce62fb6bf1975cdc09276ced335599f4 /src/zenutil/include
parent5.5.15-pre0 (diff)
downloadzen-e6f44577f469e891ed8dab1492a4c53224e0b765.tar.xz
zen-e6f44577f469e891ed8dab1492a4c53224e0b765.zip
added support for dynamic LLM tags (#245)
* added FLLMTag which can be used to register memory tags outside of core * changed `UE_MEMSCOPE` -> `ZEN_MEMSCOPE` for consistency * instrumented some subsystems with dynamic tags
Diffstat (limited to 'src/zenutil/include')
-rw-r--r--src/zenutil/include/zenutil/logging/rotatingfilesink.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/zenutil/include/zenutil/logging/rotatingfilesink.h b/src/zenutil/include/zenutil/logging/rotatingfilesink.h
index ca4649ba8..e01b86cb7 100644
--- a/src/zenutil/include/zenutil/logging/rotatingfilesink.h
+++ b/src/zenutil/include/zenutil/logging/rotatingfilesink.h
@@ -2,6 +2,7 @@
#pragma once
+#include <zencore/memory/llm.h>
#include <zenutil/basicfile.h>
ZEN_THIRD_PARTY_INCLUDES_START
@@ -24,6 +25,7 @@ public:
, m_MaxSize(MaxSize)
, m_MaxFiles(MaxFiles)
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
std::error_code Ec;
if (RotateOnOpen)
{
@@ -73,6 +75,8 @@ public:
virtual void log(const spdlog::details::log_msg& msg) override
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
try
{
spdlog::memory_buf_t Formatted;
@@ -108,6 +112,8 @@ public:
}
virtual void flush() override
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
try
{
RwLock::SharedLockScope Lock(m_Lock);
@@ -124,6 +130,8 @@ public:
virtual void set_pattern(const std::string& pattern) override
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
try
{
RwLock::ExclusiveLockScope _(m_Lock);
@@ -136,6 +144,8 @@ public:
}
virtual void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) override
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
try
{
RwLock::ExclusiveLockScope _(m_Lock);
@@ -150,6 +160,8 @@ public:
private:
void Rotate(RwLock::ExclusiveLockScope&, std::error_code& OutEc)
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
m_CurrentFile.Close();
OutEc = RotateFiles(m_BaseFilename, m_MaxFiles);
@@ -170,6 +182,8 @@ private:
bool TrySinkIt(const spdlog::details::log_msg& msg, spdlog::memory_buf_t& OutFormatted)
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
RwLock::SharedLockScope Lock(m_Lock);
if (!m_CurrentFile.IsOpen())
{
@@ -193,6 +207,8 @@ private:
bool TrySinkIt(const spdlog::memory_buf_t& Formatted)
{
+ ZEN_MEMSCOPE(ELLMTag::Logging);
+
RwLock::SharedLockScope Lock(m_Lock);
if (!m_CurrentFile.IsOpen())
{