Skip to content

Class daisy::Logger

template <LoggerDestination dest>

ClassList > daisy > Logger

Interface for simple USB logging. More...

  • #include <logger.h>

Public Functions

Type Name
Logger ()

Public Static Functions

Type Name
std::enable_if_t< D==LOGGER_UART > Configure (const LoggerImpl< LOGGER_UART >::Config cfg)
void Print (const char * format, ...)
void PrintLine (const char * format, ...)
void PrintLineV (const char * format, va_list va)
void PrintV (const char * format, va_list va)
void StartLog (bool wait_for_pc=false)

Protected Types

Type Name
enum LoggerConsts

Protected Static Attributes

Type Name
LoggerImpl< dest > impl_
size_t pc_sync_
char tx_buff_
size_t tx_ptr_

Protected Static Functions

Type Name
void AppendNewLine ()
size_t NewLineSeqLength ()
void TransmitBuf ()
void TransmitSync (const void * buffer, size_t bytes)

Detailed Description

Author:

Alexander Petrov-Savchenko ([email protected])

Date:

November 2020

Simple Example:


Public Functions Documentation

function Logger

inline daisy::Logger::Logger () 

Object constructor


Public Static Functions Documentation

function Configure

template<LoggerDestination D>
static inline std::enable_if_t< D== LOGGER_UART > daisy::Logger::Configure (
    const LoggerImpl < LOGGER_UART >::Config cfg
) 

Configuration specialization for UART Logging Only available for UART logger.


function Print

static void daisy::Logger::Print (
    const char * format,
    ...
) 

Print formatted string


function PrintLine

static void daisy::Logger::PrintLine (
    const char * format,
    ...
) 

Print formatted string appending line termination sequence


function PrintLineV

static void daisy::Logger::PrintLineV (
    const char * format,
    va_list va
) 

Variadic argument variant of PrintLine()


function PrintV

static void daisy::Logger::PrintV (
    const char * format,
    va_list va
) 

Variadic argument variant of Print()


function StartLog

static void daisy::Logger::StartLog (
    bool wait_for_pc=false
) 

Start the logging session.

Parameters:

  • wait_for_pc block until remote terminal is ready (this param has no effect when using the UART destination)

Protected Types Documentation

enum LoggerConsts

enum daisy::Logger::LoggerConsts {
    LOGGER_SYNC_OUT = 0,
    LOGGER_SYNC_IN = 2
};

Internal constants


Protected Static Attributes Documentation

variable impl_

LoggerImpl<dest> daisy::Logger< dest >::impl_;

underlying trasnfer implementation


variable pc_sync_

size_t daisy::Logger< dest >::pc_sync_;

terminal synchronization state


variable tx_buff_

char daisy::Logger< dest >::tx_buff_[128];

member variables buffer for log data


variable tx_ptr_

size_t daisy::Logger< dest >::tx_ptr_;

current position in the buffer


Protected Static Functions Documentation

function AppendNewLine

static void daisy::Logger::AppendNewLine () 

Trim control characters and append clean newline sequence, if there's room in the buffer


function NewLineSeqLength

static inline size_t daisy::Logger::NewLineSeqLength () 

Constexpr function equivalent of strlen(LOGGER_NEWLINE)


function TransmitBuf

static void daisy::Logger::TransmitBuf () 

Transfer accumulated data


function TransmitSync

static inline void daisy::Logger::TransmitSync (
    const void * buffer,
    size_t bytes
) 

Blocking wrapper for Transmit()



The documentation for this class was generated from the following file external-docs/libDaisy/src/hid/logger.h