feat: add log levels to logger
Replace log_message with log_debug/info/warn/err and a level filter controlled by logger_set_level. Extract the printf sink into log_write so CMock can intercept it in test_logger. Add 9 tests covering emit and suppression behaviour per level.
This commit is contained in:
+7
-2
@@ -2,12 +2,17 @@ add_library(ctdd_str STATIC str.c)
|
||||
target_include_directories(ctdd_str PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
target_compile_features(ctdd_str PRIVATE c_std_23)
|
||||
|
||||
# Reporter — calls log_message(); symbol resolved by the final binary
|
||||
# Reporter — calls log_info(); symbol resolved by the final binary
|
||||
add_library(ctdd_report STATIC report.c)
|
||||
target_include_directories(ctdd_report PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
target_compile_features(ctdd_report PRIVATE c_std_23)
|
||||
|
||||
# Real log_message implementation — linked into production binaries only
|
||||
# Level-filtering logger — calls log_write(); symbol resolved by the final binary
|
||||
add_library(ctdd_logger STATIC logger.c)
|
||||
target_include_directories(ctdd_logger PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
target_compile_features(ctdd_logger PRIVATE c_std_23)
|
||||
|
||||
# Real log_write implementation — linked into production binaries only
|
||||
add_library(ctdd_log_write STATIC log_write.c)
|
||||
target_include_directories(ctdd_log_write PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
target_compile_features(ctdd_log_write PRIVATE c_std_23)
|
||||
|
||||
Reference in New Issue
Block a user