mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-18 12:04:03 -04:00
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.
25 lines
599 B
C++
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};
|
|
};
|