19 uint32_t size = (uint32_t)(
sizeof(uint64_t) +
sizeof(uint64_t) +
sizeof(
Level) +
sizeof(uint8_t) + record.
logger.size() +
sizeof(uint16_t) + record.
message.size() +
sizeof(uint32_t) + record.
buffer.size());
22 record.
raw.resize(
sizeof(uint32_t) + size + 1);
25 uint8_t* buffer = record.
raw.data();
28 std::memcpy(buffer, &size,
sizeof(uint32_t));
29 buffer +=
sizeof(uint32_t);
30 std::memcpy(buffer, &record.
timestamp,
sizeof(uint64_t));
31 buffer +=
sizeof(uint64_t);
32 std::memcpy(buffer, &record.
thread,
sizeof(uint64_t));
33 buffer +=
sizeof(uint64_t);
34 std::memcpy(buffer, &record.
level,
sizeof(
Level));
35 buffer +=
sizeof(
Level);
38 uint8_t logger_size = (uint8_t)record.
logger.size();
39 std::memcpy(buffer, &logger_size,
sizeof(uint8_t));
40 buffer +=
sizeof(uint8_t);
41 std::memcpy(buffer, record.
logger.data(), record.
logger.size());
42 buffer += record.
logger.size();
45 uint16_t message_size = (uint16_t)record.
message.size();
46 std::memcpy(buffer, &message_size,
sizeof(uint16_t));
47 buffer +=
sizeof(uint16_t);
49 buffer += record.
message.size();
52 uint32_t buffer_size = (uint32_t)record.
buffer.size();
53 std::memcpy(buffer, &buffer_size,
sizeof(uint32_t));
54 buffer +=
sizeof(uint32_t);
55 std::memcpy(buffer, record.
buffer.data(), record.
buffer.size());
56 buffer += record.
buffer.size();
Binary layout definition.
void LayoutRecord(Record &record) override
Layout the given logging record into a raw buffer.
Level level
Level of the logging record.
std::vector< uint8_t > raw
Record content after layout.
std::string message
Message of the logging record.
uint64_t thread
Thread Id of the logging record.
std::string logger
Logger name of the logging record.
std::vector< uint8_t > buffer
Buffer of the logging record.
uint64_t timestamp
Timestamp of the logging record.
C++ Logging project definitions.