diff options
author | m-milkin <m-milkin@yandex-team.com> | 2023-04-14 15:40:27 +0300 |
---|---|---|
committer | m-milkin <m-milkin@yandex-team.com> | 2023-04-14 15:40:27 +0300 |
commit | fb642d882910bcf70b25fa17c3de522e61b4ac84 (patch) | |
tree | 5eb54fe4209510f211280aaaba63ede17ad1e2ea /library/cpp/logger/stream.h | |
parent | 8c60d32628e9e0c4659bd837a357b08973070031 (diff) | |
download | ydb-fb642d882910bcf70b25fa17c3de522e61b4ac84.tar.gz |
[library/cpp/logger] Support meta flags with TLogElement
Support opportunity to use TMetaFlags with TLogElement.
**Use example:**
`Log().With("Property", "Value").With("Code", "Code") << LogMessage`
Such interface allows to not parse required by TLogBackend properties from raw string.
Diffstat (limited to 'library/cpp/logger/stream.h')
-rw-r--r-- | library/cpp/logger/stream.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/library/cpp/logger/stream.h b/library/cpp/logger/stream.h index feb240afcb..a5eca9060e 100644 --- a/library/cpp/logger/stream.h +++ b/library/cpp/logger/stream.h @@ -2,11 +2,14 @@ #include "backend.h" +#include <util/generic/string.h> + + class IOutputStream; -class TStreamLogBackend: public TLogBackend { +class TStreamLogBackend : public TLogBackend { public: - TStreamLogBackend(IOutputStream* slave); + explicit TStreamLogBackend(IOutputStream* slave); ~TStreamLogBackend() override; void WriteData(const TLogRecord& rec) override; @@ -15,3 +18,18 @@ public: private: IOutputStream* Slave_; }; + +class TStreamWithContextLogBackend : public TLogBackend { +private: + static constexpr TStringBuf DELIMITER = "; "; + +public: + explicit TStreamWithContextLogBackend(IOutputStream* slave); + ~TStreamWithContextLogBackend() override; + + void WriteData(const TLogRecord& rec) override; + void ReopenLog() override; + +private: + IOutputStream* Slave_; +}; |