K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches

Public Headers

file  log.h
 
file  log_history.h
 

Data Structures

struct  kfsw_log_record
 
struct  kfsw_log_encoded
 
struct  kfsw_log_history_window
 

Macros

#define KFSW_LOG_PRINTF_LIKE(format_index, first_arg)
 
#define KFSW_LOG_MODULE   KFSW_LOG_MODULE_APP
 
#define kfsw_log_marker(...)   kfsw_log_write_marker(KFSW_LOG_MODULE, __VA_ARGS__)
 
#define KFSW_LOG_PARAM_TABLE_ID   25U
 
#define KFSW_LOG_PARAM_TABLE_NAME   "log"
 
#define KFSW_LOG_TEXT_SIZE   192U
 
#define KFSW_LOG_HISTORY_MAX_READ   32U
 
#define KFSW_LOG_ENCODED_SIZE   128U
 

Enumerations

enum  kfsw_log_module {
  KFSW_LOG_MODULE_APP = 0 , KFSW_LOG_MODULE_BOOT , KFSW_LOG_MODULE_LOG , KFSW_LOG_MODULE_PARAM ,
  KFSW_LOG_MODULE_STORAGE , KFSW_LOG_MODULE_CSP , KFSW_LOG_MODULE_UART , KFSW_LOG_MODULE_FTP ,
  KFSW_LOG_MODULE_FWU , KFSW_LOG_MODULE_HEALTH , KFSW_LOG_MODULE_COMMAND , KFSW_LOG_MODULE_EVENT ,
  KFSW_LOG_MODULE_RADIO , KFSW_LOG_MODULE_HK , KFSW_LOG_MODULE_FBO , KFSW_LOG_MODULE_CAN ,
  KFSW_LOG_MODULE_TABLE , KFSW_LOG_MODULE_REMEXEC , KFSW_LOG_MODULE_RESMON , KFSW_LOG_MODULE_GNDWDT ,
  KFSW_LOG_MODULE_SCRUB , KFSW_LOG_MODULE_LIMITS , KFSW_LOG_MODULE_COUNT
}
 

Functions

const char * kfsw_log_module_name (enum kfsw_log_module module)
 
int kfsw_log_set_module_level (enum kfsw_log_module module, uint8_t level)
 
uint8_t kfsw_log_get_module_level (enum kfsw_log_module module)
 
void kfsw_log_write (uint8_t module, uint8_t severity, const char *format,...) KFSW_LOG_PRINTF_LIKE(3
 
void void kfsw_log_write_marker (uint8_t module, const char *format,...) KFSW_LOG_PRINTF_LIKE(2
 
int kfsw_log_set_level (uint8_t level)
 
uint8_t kfsw_log_get_level (void)
 
void kfsw_log_error (const char *format,...) KFSW_LOG_PRINTF_LIKE(1
 
void void kfsw_log_warning (const char *format,...) KFSW_LOG_PRINTF_LIKE(1
 
void void void kfsw_log_info (const char *format,...) KFSW_LOG_PRINTF_LIKE(1
 
void void void void kfsw_log_debug (const char *format,...) KFSW_LOG_PRINTF_LIKE(1
 
int kfsw_log_history_window (uint16_t count, struct kfsw_log_history_window *window)
 
int kfsw_log_history_get (uint64_t sequence, struct kfsw_log_record *record)
 
int kfsw_log_history_get_encoded (uint64_t sequence, struct kfsw_log_encoded *record)
 
void kfsw_log_history_format (const struct kfsw_log_encoded *encoded, struct kfsw_log_record *record)
 

Variables

const struct kfsw_param_definition_set kfsw_log_param_definitions
 

Description

Console logging with build-time and runtime filters.

Macro Documentation

◆ KFSW_LOG_ENCODED_SIZE

#define KFSW_LOG_ENCODED_SIZE   128U

#include <log_history.h>

Bytes a held record keeps: the message as a cbprintf package (format string address, arguments and any strings from RAM), or its text when the package does not fit.

◆ kfsw_log_marker

#define kfsw_log_marker (   ...)    kfsw_log_write_marker(KFSW_LOG_MODULE, __VA_ARGS__)

#include <log.h>

Write a marker under the calling file's KFSW_LOG_MODULE.

◆ KFSW_LOG_PARAM_TABLE_ID

#define KFSW_LOG_PARAM_TABLE_ID   25U

#include <log.h>

Parameter table of the log service, in the service band.

◆ KFSW_LOG_PARAM_TABLE_NAME

#define KFSW_LOG_PARAM_TABLE_NAME   "log"

#include <log.h>

Parameter table name.

Enumeration Documentation

◆ kfsw_log_module

#include <log.h>

Modules a message can be attributed to.

The order matches the level array and the snapshot, so don't renumber them.

Function Documentation

◆ kfsw_log_debug()

void void void void kfsw_log_debug ( const char *  format,
  ... 
)

#include <log.h>

Log a debug message.

Parameters
formatprintf-style format string.
...Format arguments.

◆ kfsw_log_error()

void kfsw_log_error ( const char *  format,
  ... 
)

#include <log.h>

Log an error message.

Parameters
formatprintf-style format string.
...Format arguments.

◆ kfsw_log_get_level()

uint8_t kfsw_log_get_level ( void  )

#include <log.h>

Return the active runtime minimum log level.

◆ kfsw_log_get_module_level()

uint8_t kfsw_log_get_module_level ( enum kfsw_log_module  module)

#include <log.h>

The minimum level one module is held to.

Returns the disabled level for a module this build does not know, so a caller that walks the list cannot read past it.

◆ kfsw_log_history_format()

void kfsw_log_history_format ( const struct kfsw_log_encoded *  encoded,
struct kfsw_log_record *  record 
)

#include <log_history.h>

Format a held record into text; newlines become spaces.

◆ kfsw_log_history_get()

int kfsw_log_history_get ( uint64_t  sequence,
struct kfsw_log_record *  record 
)

#include <log_history.h>

Read one sequence as text.

-ENOENT means it was overwritten or never recorded.

◆ kfsw_log_history_get_encoded()

int kfsw_log_history_get_encoded ( uint64_t  sequence,
struct kfsw_log_encoded *  record 
)

#include <log_history.h>

Read one sequence as it is held, package or text.

◆ kfsw_log_history_window()

int kfsw_log_history_window ( uint16_t  count,
struct kfsw_log_history_window *  window 
)

#include <log_history.h>

Snapshot the bounds of the newest count records, without consuming them.

◆ kfsw_log_info()

void void void kfsw_log_info ( const char *  format,
  ... 
)

#include <log.h>

Log an informational message.

Parameters
formatprintf-style format string.
...Format arguments.

◆ kfsw_log_module_name()

const char * kfsw_log_module_name ( enum kfsw_log_module  module)

#include <log.h>

Short stable name for a module, as the shell and the docs print it.

◆ kfsw_log_set_level()

int kfsw_log_set_level ( uint8_t  level)

#include <log.h>

Set the runtime minimum log level (0 DEBUG through 4 disabled).

◆ kfsw_log_set_module_level()

int kfsw_log_set_module_level ( enum kfsw_log_module  module,
uint8_t  level 
)

#include <log.h>

Set the minimum level for one module.

Return values
0Applied.
-EINVALUnknown module.
-ERANGELevel above 4.

◆ kfsw_log_warning()

void void kfsw_log_warning ( const char *  format,
  ... 
)

#include <log.h>

Log a warning message.

Parameters
formatprintf-style format string.
...Format arguments.

◆ kfsw_log_write()

void kfsw_log_write ( uint8_t  module,
uint8_t  severity,
const char *  format,
  ... 
)

#include <log.h>

Write one message.

Called through the kfsw_log_* macros, not directly.

A s argument must be NUL-terminated even with a precision, as in %.*s: the history keeps a copy of each string from RAM, and that copy reads to the terminator.

◆ kfsw_log_write_marker()

void void kfsw_log_write_marker ( uint8_t  module,
const char *  format,
  ... 
)

#include <log.h>

Write a marker that scripts look for, such as @READY.

No level hides a marker. It is kept in the history like any message and printed without a level tag or colour, so the line starts with the marker. Called through kfsw_log_marker(), not directly.

Variable Documentation

◆ kfsw_log_param_definitions

const struct kfsw_param_definition_set kfsw_log_param_definitions
extern

#include <log.h>

Parameter definitions of the log service.