51 #ifndef SATCAT5_LOG_MAXLEN
52 #define SATCAT5_LOG_MAXLEN 255
55 #ifndef SATCAT5_LOG_CONCISE
56 #define SATCAT5_LOG_CONCISE 1
59 #ifndef SATCAT5_WELCOME_EMOJI
60 #define SATCAT5_WELCOME_EMOJI "\xf0\x9f\x9b\xb0\xef\xb8\x8f\xf0\x9f\x90\xb1\xf0\x9f\x95\x94"
76 virtual void log_event(s8 priority,
unsigned nbytes,
const char* msg) = 0;
82 friend satcat5::util::ListCore;
100 void log_event(s8 priority,
unsigned nbytes,
const char* msg)
override;
143 void wr_fix(
const char* str,
unsigned len);
145 void wr_str(
const char* str);
148 void wr_h32(u32 val,
unsigned nhex = 8);
151 void wr_h64(u64 val,
unsigned nhex = 16);
155 void wr_d32(u32 val,
unsigned zpad = 0);
158 void wr_d64(u64 val,
unsigned zpad = 0);
161 void wr_s32(s32 val,
unsigned zpad = 0);
164 void wr_s64(s64 val,
unsigned zpad = 0);
166 inline void wr_dec(u32 val) {wr_d32(val);}
168 inline void wr_hex(u32 val) {wr_h32(val);}
171 unsigned len()
const {
return m_wridx;}
181 inline void terminate() {m_buff[m_wridx] = 0;}
185 char m_buff[SATCAT5_LOG_MAXLEN+1];
199 explicit Log(s8 priority);
200 Log(s8 priority,
const char* str);
201 Log(s8 priority,
const char* str1,
const char* str2);
202 Log(s8 priority,
const void* str,
unsigned nbytes);
216 Log& write(
const char* str);
217 Log& write(
bool val);
223 Log& write(
const u8* val,
unsigned nbytes);
233 Log& write10(s32 val);
234 Log& write10(s64 val);
235 Log& write10(u32 val);
236 Log& write10(u64 val);
252 {obj.log_to(m_buff);
return *
this;}
257 Log& operator=(
const Log&) =
delete;
267 bool pre_test_reset();
273 #if SATCAT5_LOG_CONCISE
Abstract API for reading byte-streams and packets.
Abstract API for writing byte-streams and packets.
Defines the interface for accepting Log messages.
virtual void log_event(s8 priority, unsigned nbytes, const char *msg)=0
Callback for each formatted Log message.
EventHandler()
Constructor automatically manages the list of active handler objects.
Internal buffer used by the Log class.
unsigned len() const
Number of characters written to this buffer.
LogBuffer()
Constructor for an empty buffer.
void wr_hex(u32 val)
Legacy alias for wr_h32.
void wr_dec(u32 val)
Legacy alias for wr_d32.
The Log class creates and formats one log message.
Log & write10(s8 val)
Print integer as a decimal value with no leading zeros.
Log & write10(u8 val)
Print integer as a decimal value with no leading zeros.
Log & write10(s16 val)
Print integer as a decimal value with no leading zeros.
Log & write_obj(const T &obj)
Templated wrapper for custom output formatting.
Log & write10(u16 val)
Print integer as a decimal value with no leading zeros.
Copy Log messages to any Writeable interface.
Templated functions for manipulating singly-linked lists.
constexpr s8 CRITICAL
Define basic priority codes for log messages.
const char * priority_label(s8 priority)
Convert priority code to a human-readable UTF-8 string.
constexpr s8 WARNING
Define basic priority codes for log messages.
constexpr s8 ERROR
Define basic priority codes for log messages.
constexpr s8 DEBUG
Define basic priority codes for log messages.
constexpr s8 INFO
Define basic priority codes for log messages.
An Ethernet MAC address (with serializable interface).
IPv4 address is a 32-bit unsigned integer.
Basic type aliases and prototypes used throughout SatCat5.