SatCat5
satcat5::log::Log Class Referencefinal

Detailed Description

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.

Definition at line 195 of file log.h.

#include <log.h>

Collaboration diagram for satcat5::log::Log:
[legend]

Public Member Functions

 ~Log ()
 Destructor sends the message.
 
template<class T >
Logwrite_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.
 
Logwrite (const char *str)
 Formatting methods for various data types. More...
 
Logwrite (bool val)
 Formatting methods for various data types. More...
 
Logwrite (u8 val)
 Formatting methods for various data types. More...
 
Logwrite (u16 val)
 Formatting methods for various data types. More...
 
Logwrite (u32 val)
 Formatting methods for various data types. More...
 
Logwrite (u64 val)
 Formatting methods for various data types. More...
 
Logwrite (satcat5::io::Readable *rd)
 Formatting methods for various data types. More...
 
Logwrite (const u8 *val, unsigned nbytes)
 Formatting methods for various data types. More...
 
Logwrite (const satcat5::eth::MacAddr &mac)
 Formatting methods for various data types. More...
 
Logwrite (const satcat5::ip::Addr &ip)
 Formatting methods for various data types. More...
 
Logwrite10 (s32 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (s64 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (u32 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (u64 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (s8 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (s16 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (u8 val)
 Print integer as a decimal value with no leading zeros. More...
 
Logwrite10 (u16 val)
 Print integer as a decimal value with no leading zeros. More...
 

Private Member Functions

 Log (const Log &)=delete
 
Logoperator= (const Log &)=delete
 

Private Attributes

const s8 m_priority
 
satcat5::log::LogBuffer m_buff
 

Member Function Documentation

◆ write() [1/10]

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.

Definition at line 203 of file log.cc.

◆ write() [2/10]

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.

Definition at line 198 of file log.cc.

◆ write() [3/10]

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.

Definition at line 247 of file log.cc.

◆ write() [4/10]

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.

Definition at line 255 of file log.cc.

◆ write() [5/10]

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.

Definition at line 240 of file log.cc.

◆ write() [6/10]

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.

Definition at line 233 of file log.cc.

◆ write() [7/10]

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.

Definition at line 215 of file log.cc.

◆ write() [8/10]

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.

Definition at line 221 of file log.cc.

◆ write() [9/10]

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.

Definition at line 227 of file log.cc.

◆ write() [10/10]

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.

Definition at line 209 of file log.cc.

◆ write10() [1/8]

Log& satcat5::log::Log::write10 ( s16  val)
inline

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 238 of file log.h.

◆ write10() [2/8]

Log & Log::write10 ( s32  val)

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 261 of file log.cc.

◆ write10() [3/8]

Log & Log::write10 ( s64  val)

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 267 of file log.cc.

◆ write10() [4/8]

Log& satcat5::log::Log::write10 ( s8  val)
inline

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 237 of file log.h.

◆ write10() [5/8]

Log& satcat5::log::Log::write10 ( u16  val)
inline

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 240 of file log.h.

◆ write10() [6/8]

Log & Log::write10 ( u32  val)

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 273 of file log.cc.

◆ write10() [7/8]

Log & Log::write10 ( u64  val)

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 279 of file log.cc.

◆ write10() [8/8]

Log& satcat5::log::Log::write10 ( u8  val)
inline

Print integer as a decimal value with no leading zeros.

As with "write", these methods append text to the output and include the " = " prefix. Signed values also include a leading "+" or "-" token.

Definition at line 239 of file log.h.

◆ write_obj()

template<class T >
Log& satcat5::log::Log::write_obj ( const T &  obj)
inline

Templated wrapper for custom output formatting.

To implement custom formatting for a given object, that object must impelment the following method:

void log_to(satcat5::log::LogBuffer& wr) const;
Internal buffer used by the Log class.
Definition: log.h:134

The log_to() method should then write to the provided LogBuffer object using its formatting methods.

Definition at line 251 of file log.h.


The documentation for this class was generated from the following files: