Files
MuditaOS/module-utils/log/LoggerWorker.hpp
Lefucjusz 8d96f2d354 [MOS-993] Logger bug fixes and optimizations
Fixes and optimizations in logger:

* fixed possible buffer overflow when logging
logs over line buffer size;
* reduced max log line length to 2048;
* moved pubsetbuf before file opening;
* log file stream buffer created once
in logger ctor;
* updatet UTs;
* additional minor cleanup.
2023-05-29 09:38:57 +02:00

36 lines
975 B
C++

// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <Service/Worker.hpp>
namespace Log
{
static constexpr auto workerName = "LoggerWorker";
class LoggerWorker : public sys::Worker
{
public:
enum class Signal
{
DumpFilledBuffer,
DumpIntervalBuffer,
DumpDiagnostic
};
static constexpr auto SignalQueueName = "LoggerSignal";
static constexpr auto SignalSize = sizeof(Signal);
static constexpr auto SignalQueueLength = 1;
explicit LoggerWorker(const std::string &name);
void notify(Signal command);
bool handleMessage(std::uint32_t queueID) override;
void handleCommand(Signal command);
private:
static constexpr auto priority = static_cast<UBaseType_t>(sys::ServicePriority::Idle);
};
} // namespace Log