GPS Device
Loading...
Searching...
No Matches
log.c File Reference

Log subsystem implementation. More...

#include <stdarg.h>
#include "log.h"
#include "common.h"
#include "err.h"
#include "stm32f401re_gpio.h"
#include "stm32f401re_usart.h"
#include "stm32f401re_rtc.h"
#include "modules.h"
#include "init.h"
Include dependency graph for log.c:

Go to the source code of this file.

Classes

struct  internal_state_s
 Internal state of the SysTick driver. More...

Functions

static ERR_te log_print_prologue (MODULES_te subsys, LOG_LEVEL_te log_level)
 Prints the log message prologue: timestamp, severity, and subsystem name.
ERR_te log_init (LOG_HANDLE_ts *log_handle)
 Initializes the log subsystem.
ERR_te log_deinit ()
 Deinitializes the log subsystem.
ERR_te log_print (MODULES_te subsys, LOG_LEVEL_te subsys_log_level, LOG_LEVEL_te log_level, char *msg,...)
 Prints a formatted message to the serial terminal if the severity threshold is met.
ERR_te log_get_level_name (LOG_LEVEL_te log_level, char *str)
 Converts a LOG_LEVEL_te value to its lowercase string name.
ERR_te log_level_to_int (char const *str, LOG_LEVEL_te *log_level)
 Converts a log level name string to its LOG_LEVEL_te value.
ERR_te log_set_force_disable (bool bool_status)
 Enables or disables forced suppression of all log output.

Variables

const char * modules_names []
 External array mapping MODULES_te values to their name strings.
static struct internal_state_s internal_state = { 0 }
 Singleton instance of the log subsystem internal state.

Detailed Description

Log subsystem implementation.

Author
github.com/Baksi675
Version
0.1
Date
2025-09-04

Definition in file log.c.

Variable Documentation

◆ modules_names

const char* modules_names[]
extern

External array mapping MODULES_te values to their name strings.

External array mapping MODULES_te values to their name strings.

Indexed by MODULES_te values. Used by the log subsystem to prefix each log message with the originating subsystem name, and by the CLI to display module names.

The order and count of entries must remain in sync with MODULES_te.

Definition at line 24 of file modules.c.

24 {
25 [MODULES_CMD] = "cmd",
26 [MODULES_SSD1309] = "ssd1309",
27 [MODULES_NEO6] = "neo6",
28 [MODULES_IO] = "io",
29 [MODULES_BUTTON] = "button",
30 [MODULES_MENU] = "menu",
31 [MODULES_SD] = "sd",
32 [MODULES_DATALOG] = "datalog"
33}
@ MODULES_SD
Definition modules.h:49
@ MODULES_CMD
Definition modules.h:43
@ MODULES_BUTTON
Definition modules.h:47
@ MODULES_SSD1309
Definition modules.h:44
@ MODULES_NEO6
Definition modules.h:45
@ MODULES_MENU
Definition modules.h:48
@ MODULES_DATALOG
Definition modules.h:50
@ MODULES_IO
Definition modules.h:46

◆ internal_state

struct internal_state_s internal_state = { 0 }
static

Singleton instance of the log subsystem internal state.

Definition at line 45 of file log.c.

45{ 0 };