|
SatCat5
|
The Log class creates and formats one log message.
SatCat5 logging system concepts.
Each Log is an emphemeral object that creates, formats, and emits a human-readable message. When the Log object falls out of scope, the message is sent to each EventHandler.
#include <log.h>
Public Member Functions | |
| ~Log () | |
| Destructor sends the message. | |
| template<class T > | |
| Log & | write_obj (const T &obj) |
| Templated wrapper for custom output formatting. More... | |
| Log (s8 priority) | |
| Constructor sets priority and optionally the first string. | |
| Log (s8 priority, const char *str) | |
| Constructor sets priority and optionally the first string. | |
| Log (s8 priority, const char *str1, const char *str2) | |
| Constructor sets priority and optionally the first string. | |
| Log (s8 priority, const void *str, unsigned nbytes) | |
| Constructor sets priority and optionally the first string. | |
| Log & | write (const char *str) |
| Formatting methods for various data types. More... | |
| Log & | write (bool val) |
| Formatting methods for various data types. More... | |
| Log & | write (u8 val) |
| Formatting methods for various data types. More... | |
| Log & | write (u16 val) |
| Formatting methods for various data types. More... | |
| Log & | write (u32 val) |
| Formatting methods for various data types. More... | |
| Log & | write (u64 val) |
| Formatting methods for various data types. More... | |
| Log & | write (satcat5::io::Readable *rd) |
| Formatting methods for various data types. More... | |
| Log & | write (const u8 *val, unsigned nbytes) |
| Formatting methods for various data types. More... | |
| Log & | write (const satcat5::eth::MacAddr &mac) |
| Formatting methods for various data types. More... | |
| Log & | write (const satcat5::ip::Addr &ip) |
| Formatting methods for various data types. More... | |
| Log & | write10 (s32 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (s64 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (u32 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (u64 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (s8 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (s16 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (u8 val) |
| Print integer as a decimal value with no leading zeros. More... | |
| Log & | write10 (u16 val) |
| Print integer as a decimal value with no leading zeros. More... | |
Private Member Functions | |
| Log (const Log &)=delete | |
| Log & | operator= (const Log &)=delete |
Private Attributes | |
| const s8 | m_priority |
| satcat5::log::LogBuffer | m_buff |
| Log & Log::write | ( | bool | val | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | const char * | str | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | const satcat5::eth::MacAddr & | mac | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | const satcat5::ip::Addr & | ip | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | const u8 * | val, |
| unsigned | nbytes | ||
| ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | satcat5::io::Readable * | rd | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | u16 | val | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | u32 | val | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | u64 | val | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
| Log & Log::write | ( | u8 | val | ) |
Formatting methods for various data types.
Each "write" method appends text to the Log message. By convention, integer types add prefix " = 0x" and print as a fixed-width hexadecimal value. Use "write10" for decimal. Other values, except strings, add prefix " = " instead. Network types use conventional form (e.g., "192.168.1.42"). Returns reference to itself to make chaining easy.
|
inline |
| Log & Log::write10 | ( | s32 | val | ) |
| Log & Log::write10 | ( | s64 | val | ) |
|
inline |
|
inline |
| Log & Log::write10 | ( | u32 | val | ) |
| Log & Log::write10 | ( | u64 | val | ) |
|
inline |
|
inline |
Templated wrapper for custom output formatting.
To implement custom formatting for a given object, that object must impelment the following method:
The log_to() method should then write to the provided LogBuffer object using its formatting methods.