Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Logging Module - User Guide

What is Logging?

  • Logging provides bounded ring-buffer logging for diagnostics. All entries
  • go to fixed buffer; oldest entries overwritten when full.

Log Levels

  • DEBUG - Development diagnostics (disabled in production)
  • INFO - Informational events
  • WARNING - Potential issues, continuing
  • ERROR - Failures, recovery attempted
  • CRITICAL - Imminent shutdown

Quick Start

  • * sapi_log_debug("value=%d", x);
    * sapi_log_info("System initialized");
    * sapi_log_warning("Low battery");
    * sapi_log_error("Read failed: %s", reason);
    * sapi_log_critical("Entering safe-state");
    *

Best Practices

  • 1. Use appropriate level
  • 2. Include context (what, why, state)
  • 3. Never log secrets (passwords, keys)
  • 4. Flush before shutdown/reboot

See Also