libstp
Robotics library for Botball
Loading...
Searching...
No Matches
logging Namespace Reference

Namespaces

namespace  detail

Enumerations

enum class  Level : int {
  trace = LIBSTP_LOG_LEVEL_TRACE , debug = LIBSTP_LOG_LEVEL_DEBUG , info = LIBSTP_LOG_LEVEL_INFO , warn = LIBSTP_LOG_LEVEL_WARN ,
  error = LIBSTP_LOG_LEVEL_ERROR , critical = LIBSTP_LOG_LEVEL_CRITICAL , off = LIBSTP_LOG_LEVEL_OFF
}
 Runtime severity used by the foundation logger and its Python bindings. More...

Functions

void initialize_timer ()
 Reset the relative elapsed-time clock used by the log formatter.
void init ()
 Initialize the shared logger, sinks, and formatter. Safe to call more than once.
bool is_enabled (Level level)
void log (Level level, std::string_view message)
 Log a preformatted message without source-location context.
void log (Level level, const char *source_file, int line, const char *func, std::string_view message)
template<typename... Args>
void logf (Level level, std::string_view fmt_str, Args &&... args)
template<typename... Args>
void logf_loc (Level level, const char *file, int line, const char *func, std::string_view fmt_str, Args &&... args)
void shutdown ()
std::shared_ptr< spdlog::logger > core ()
 Access the shared spdlog logger after initialization.

Enumeration Type Documentation

◆ Level

enum class logging::Level : int
strong

Runtime severity used by the foundation logger and its Python bindings.

Enumerator
trace 
debug 
info 
warn 
error 
critical 
off 

Definition at line 32 of file logging.hpp.

Function Documentation

◆ core()

std::shared_ptr< spdlog::logger > logging::core ( )

Access the shared spdlog logger after initialization.

◆ init()

void logging::init ( )

Initialize the shared logger, sinks, and formatter. Safe to call more than once.

◆ initialize_timer()

void logging::initialize_timer ( )

Reset the relative elapsed-time clock used by the log formatter.

◆ is_enabled()

bool logging::is_enabled ( Level level)

Query whether logging is live (initialized and not shut down). There is no runtime level filtering: what is compiled in (the FOUNDATION_LOG_ACTIVE_LEVEL gate at the call site) is what the JSONL file captures. The console shows warn/error only, enforced natively by the console sink's level.

◆ log() [1/2]

void logging::log ( Level level,
const char * source_file,
int line,
const char * func,
std::string_view message )

Log a preformatted message while annotating the originating source location (file / line / function). These land as discrete fields in the JSONL record.

◆ log() [2/2]

void logging::log ( Level level,
std::string_view message )

Log a preformatted message without source-location context.

◆ logf()

template<typename... Args>
void logging::logf ( Level level,
std::string_view fmt_str,
Args &&... args )
inline

Definition at line 82 of file logging.hpp.

◆ logf_loc()

template<typename... Args>
void logging::logf_loc ( Level level,
const char * file,
int line,
const char * func,
std::string_view fmt_str,
Args &&... args )
inline

Definition at line 102 of file logging.hpp.

◆ shutdown()

void logging::shutdown ( )

Flush and tear down the logger so that no further log calls touch spdlog. Must be called before C++ static destruction begins (e.g. from a Python atexit handler) to avoid use-after-free in cross-library static teardown.