Files
MuditaOS/module-utils/log/LoggerBuffer.hpp
Dawid Wojtas e77b5d6702 [MOS-424] Improvement of logger module
Due to losing bytes the logger has a worker
which is responsible for dumping logs to
the file. The logger also has its own timer
to dump logs every 15 minutes. EventManager
is not responsible for interval dumping logs
now.
2022-09-15 11:58:09 +02:00

25 lines
599 B
C++

// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include "StringCircularBuffer.hpp"
class LoggerBuffer : public StringCircularBuffer
{
public:
explicit LoggerBuffer(size_t size) : StringCircularBuffer(size)
{}
[[nodiscard]] std::pair<bool, std::string> get();
void put(const std::string &logMsg);
void put(std::string &&logMsg);
static constexpr auto lostBytesMessage = "bytes was lost.";
private:
void updateNumOfLostBytes();
size_t numOfLostBytes{0};
};