mpacklog — Log dictionaries to file using MessagePack
v2.1.0
|
Go to the documentation of this file.
26 #include <palimpsest/Dictionary.h>
34 #include "mpacklog/CircularBuffer.h"
39 using palimpsest::Dictionary;
73 explicit Logger(
const std::string &path,
bool append =
false);
89 bool put(
char *data,
size_t size);
99 inline bool put(
const Dictionary &dict) {
100 size_t size = dict.serialize(serialization_buffer_);
101 return Logger::put(serialization_buffer_.data(), size);
119 bool keep_going_ =
true;
125 std::pair<char *, size_t> pop_;
133 std::vector<char> serialization_buffer_;
136 size_t last_size_ = 0;
~Logger()
Stop the logging thread.
Log action and observation dictionaries to MessagePack binary files.
Logger(const std::string &path, bool append=false)
Open a new log file and start the logging thread.
size_t last_size() const
Size of the last message in bytes.
bool put(const Dictionary &dict)
Save a dictionary to be written to the log.
bool put(char *data, size_t size)
Save data to be written to the log.
constexpr size_t kBufferSize
Number of slots in the internal circular buffer.