Internal buffer used by the Log class.
SatCat5 logging system concepts.
This buffer holds the contents of a Log message, provides low-level formatting, and provides length checks to ensure that long messages are truncated safely.
The LogBuffer class is the required API for classes that wish to provide custom output formatting.
- See also
- satcat5::log::Log::write_obj
Definition at line 134 of file log.h.
#include <log.h>
|
|
| LogBuffer () |
| | Constructor for an empty buffer.
|
| |
|
const char * | c_str () |
| | Buffer contents, in the form of a null-terminated string.
|
| |
|
void | wr_fix (const char *str, unsigned len) |
| | Write a fixed-length UTF-8 string.
|
| |
|
void | wr_str (const char *str) |
| | Write a null-terminated UTF-8 string.
|
| |
| void | wr_h32 (u32 val, unsigned nhex=8) |
| | Write an integer (u32) in hexadecimal format. More...
|
| |
| void | wr_h64 (u64 val, unsigned nhex=16) |
| | Write an integer (u64) in hexadecimal format. More...
|
| |
| void | wr_d32 (u32 val, unsigned zpad=0) |
| | Write an unsigned integer (u32) in decimal format. More...
|
| |
| void | wr_d64 (u64 val, unsigned zpad=0) |
| | Write an unsigned integer (u64) in decimal format. More...
|
| |
| void | wr_s32 (s32 val, unsigned zpad=0) |
| | Write a signed integer (s32) in decimal format. More...
|
| |
| void | wr_s64 (s64 val, unsigned zpad=0) |
| | Write a signed integer (s64) in decimal format. More...
|
| |
|
void | wr_dec (u32 val) |
| | Legacy alias for wr_d32.
|
| |
|
void | wr_hex (u32 val) |
| | Legacy alias for wr_h32.
|
| |
|
unsigned | len () const |
| | Number of characters written to this buffer.
|
| |
|
|
unsigned | m_wridx |
| |
|
char | m_buff [SATCAT5_LOG_MAXLEN+1] |
| |
◆ wr_d32()
| void LogBuffer::wr_d32 |
( |
u32 |
val, |
|
|
unsigned |
zpad = 0 |
|
) |
| |
Write an unsigned integer (u32) in decimal format.
For zero-padding to N digits, set second argument to 10^N-1. e.g., wr_d32(123, 9999) --> "0123"
Definition at line 317 of file log.cc.
◆ wr_d64()
| void LogBuffer::wr_d64 |
( |
u64 |
val, |
|
|
unsigned |
zpad = 0 |
|
) |
| |
Write an unsigned integer (u64) in decimal format.
For zero-padding to N digits, set second argument to 10^N-1.
Definition at line 323 of file log.cc.
◆ wr_h32()
| void LogBuffer::wr_h32 |
( |
u32 |
val, |
|
|
unsigned |
nhex = 8 |
|
) |
| |
Write an integer (u32) in hexadecimal format.
The second argument is the number of hexadecimal digits.
Definition at line 303 of file log.cc.
◆ wr_h64()
| void LogBuffer::wr_h64 |
( |
u64 |
val, |
|
|
unsigned |
nhex = 16 |
|
) |
| |
Write an integer (u64) in hexadecimal format.
The second argument is the number of hexadecimal digits.
Definition at line 310 of file log.cc.
◆ wr_s32()
| void LogBuffer::wr_s32 |
( |
s32 |
val, |
|
|
unsigned |
zpad = 0 |
|
) |
| |
Write a signed integer (s32) in decimal format.
For zero-padding to N digits, set second argument to 10^N-1.
Definition at line 329 of file log.cc.
◆ wr_s64()
| void LogBuffer::wr_s64 |
( |
s64 |
val, |
|
|
unsigned |
zpad = 0 |
|
) |
| |
Write a signed integer (s64) in decimal format.
For zero-padding to N digits, set second argument to 10^N-1.
Definition at line 334 of file log.cc.
The documentation for this class was generated from the following files: