Learn more: The pw_log protobuf
|
constexpr uint32_t | pw::log::PackLineLevel (uint32_t line_number, uint8_t level) |
|
constexpr std::tuple< uint32_t, uint8_t > | pw::log::UnpackLineLevel (uint32_t line_and_level) |
|
Result< ConstByteSpan > | pw::log::EncodeLog (int level, unsigned int flags, std::string_view module_name, std::string_view thread_name, std::string_view file_name, int line_number, int64_t ticks_since_epoch, std::string_view message, ByteSpan encode_buffer) |
|
pwpb::LogEntry::MemoryEncoder | pw::log::CreateEncoderAndEncodeTokenizedLog (log_tokenized::Metadata metadata, ConstByteSpan tokenized_data, int64_t ticks_since_epoch, ByteSpan encode_buffer) |
|
Result< ConstByteSpan > | pw::log::EncodeTokenizedLog (log_tokenized::Metadata metadata, ConstByteSpan tokenized_data, int64_t ticks_since_epoch, ByteSpan encode_buffer) |
|
Result< ConstByteSpan > | pw::log::EncodeTokenizedLog (log_tokenized::Metadata metadata, const uint8_t *tokenized_data, size_t tokenized_data_size, int64_t ticks_since_epoch, ByteSpan encode_buffer) |
|
Result< ConstByteSpan > | pw::log::EncodeTokenizedLog (log_tokenized::Metadata metadata, const uint8_t *tokenized_data, size_t tokenized_data_size, int64_t ticks_since_epoch, ConstByteSpan thread_name, ByteSpan encode_buffer) |
|
Result< ConstByteSpan > | pw::log::EncodeTokenizedLog (log_tokenized::Metadata metadata, ConstByteSpan tokenized_data, int64_t ticks_since_epoch, ConstByteSpan thread_name, ByteSpan encode_buffer) |
|
◆ CreateEncoderAndEncodeTokenizedLog()
Encodes tokenized message and metadata, with a timestamp as a log proto. Extra fields can be encoded into the returned encoder. The caller must check the encoder status.
◆ EncodeLog()
Result< ConstByteSpan > pw::log::EncodeLog |
( |
int |
level, |
|
|
unsigned int |
flags, |
|
|
std::string_view |
module_name, |
|
|
std::string_view |
thread_name, |
|
|
std::string_view |
file_name, |
|
|
int |
line_number, |
|
|
int64_t |
ticks_since_epoch, |
|
|
std::string_view |
message, |
|
|
ByteSpan |
encode_buffer |
|
) |
| |
Convenience functions to encode multiple log attributes as a log proto message.
- Returns
- A byte span containing the encoded log proto on success or one of the following error codes on failure.
- Return values
-
◆ EncodeTokenizedLog() [1/3]
Encodes tokenized message (passed as pointer and size), tokenized metadata, timestamp, and thread name as a log proto.
- Returns
- A byte span containing the encoded log proto on success or one of the following error codes on failure.
- Return values
-
◆ EncodeTokenizedLog() [2/3]
Convenience functions to convert from tokenized metadata to the log proto format.
- Returns
- A byte span containing the encoded log proto on success or one of the following error codes on failure.
- Return values
-
◆ EncodeTokenizedLog() [3/3]
Encodes tokenized message (passed as a byte span), tokenized metadata, timestamp, and thread name as a log proto.
- Returns
- A byte span containing the encoded log proto on success or one of the following error codes on failure.
- Return values
-
◆ PackLineLevel()
constexpr uint32_t pw::log::PackLineLevel |
( |
uint32_t |
line_number, |
|
|
uint8_t |
level |
|
) |
| |
|
inlineconstexpr |
Packs line number and log level into a single uint32_t
as dictated by the line_level
field in the Log proto message.
- Note
line_number
is restricted to 29 bits. Values beyond 536870911
will be lost. level
is restricted to 3 bits. Values beyond 7
will be lost.
◆ UnpackLineLevel()
constexpr std::tuple< uint32_t, uint8_t > pw::log::UnpackLineLevel |
( |
uint32_t |
line_and_level | ) |
|
|
inlineconstexpr |
Unpacks the line_level
field as dictated by the Log proto message into line number (uint32_t
) and level (uint8_t
).