1414 * Internal State Management - Singleton Pattern like Node.js Logger
1515 * ============================================================================ */
1616
17- static bool logger_initialized = false;
18- static int current_log_level = VALKEY_LOG_LEVEL_DEFAULT ;
17+ static bool logger_initialized = false;
18+ static int current_log_level = VALKEY_LOG_LEVEL_DEFAULT ;
19+ #if LOGGER_FFI_ENABLED
1920static enum Level current_ffi_log_level = LEVEL_WARN ; /* FFI level tracking */
21+ #endif
2022
2123/* Simple mutex simulation using static variable for initialization protection */
2224static volatile bool initialization_in_progress = false;
@@ -25,6 +27,7 @@ static volatile bool initialization_in_progress = false;
2527 * Level Conversion Functions
2628 * ============================================================================ */
2729
30+ #if LOGGER_FFI_ENABLED
2831/**
2932 * Convert C integer log level to FFI Level enum
3033 */
@@ -68,7 +71,7 @@ static int ffi_level_to_int(enum Level level) {
6871 return VALKEY_LOG_LEVEL_WARN ; /* Default fallback */
6972 }
7073}
71-
74+ #endif
7275/* ============================================================================
7376 * Utility Functions
7477 * ============================================================================ */
@@ -187,10 +190,11 @@ void valkey_glide_logger_log(const char* level, const char* identifier, const ch
187190 return ;
188191 }
189192
190- int level_int = valkey_glide_logger_level_from_string (level );
193+ int level_int = valkey_glide_logger_level_from_string (level );
194+ #if LOGGER_FFI_ENABLED
191195 enum Level ffi_level = int_to_ffi_level (level_int );
192196
193- #if LOGGER_FFI_ENABLED
197+
194198 /* Call the new FFI log function with current logger level */
195199 valkey_log (ffi_level , current_ffi_log_level , identifier , message );
196200#endif
0 commit comments