stream.cpp 858 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "stream.h"
  2. #include "record.h"
  3. #include <util/stream/output.h>
  4. TStreamLogBackend::TStreamLogBackend(IOutputStream* slave)
  5. : Slave_(slave)
  6. {
  7. }
  8. TStreamLogBackend::~TStreamLogBackend() {
  9. }
  10. void TStreamLogBackend::WriteData(const TLogRecord& rec) {
  11. Slave_->Write(rec.Data, rec.Len);
  12. }
  13. void TStreamLogBackend::ReopenLog() {
  14. }
  15. TStreamWithContextLogBackend::TStreamWithContextLogBackend(IOutputStream* slave)
  16. : Slave_(slave)
  17. {
  18. }
  19. TStreamWithContextLogBackend::~TStreamWithContextLogBackend() {
  20. }
  21. void TStreamWithContextLogBackend::WriteData(const TLogRecord& rec) {
  22. Slave_->Write(rec.Data, rec.Len);
  23. Slave_->Write(DELIMITER);
  24. for (const auto& [key, value] : rec.MetaFlags) {
  25. Slave_->Write(TString::Join(key, "=", value));
  26. Slave_->Write(DELIMITER);
  27. }
  28. }
  29. void TStreamWithContextLogBackend::ReopenLog() {
  30. }