@@ -33,10 +33,11 @@ pub unsafe extern "C" fn ccxr_init_basic_logger() {
3333 . unwrap_or ( DebugMessageFlag :: VERBOSE ) ;
3434 let mask = DebugMessageMask :: new ( debug_mask, debug_mask_on_debug) ;
3535 let gui_mode_reports = ccx_options. gui_mode_reports != 0 ;
36+ // CCX_MESSAGES_QUIET=0, CCX_MESSAGES_STDOUT=1, CCX_MESSAGES_STDERR=2
3637 let messages_target = match ccx_options. messages_target {
37- 0 => OutputTarget :: Stdout ,
38- 1 => OutputTarget :: Stderr ,
39- 2 => OutputTarget :: Quiet ,
38+ 0 => OutputTarget :: Quiet ,
39+ 1 => OutputTarget :: Stdout ,
40+ 2 => OutputTarget :: Stderr ,
4041 _ => OutputTarget :: Stderr , // Default to stderr for invalid values
4142 } ;
4243 let _ = set_logger ( CCExtractorLogger :: new (
@@ -46,6 +47,28 @@ pub unsafe extern "C" fn ccxr_init_basic_logger() {
4647 ) ) ;
4748}
4849
50+ /// Updates the logger target after command-line arguments have been parsed.
51+ /// This is needed because the logger is initialized before argument parsing,
52+ /// and options like --quiet need to be applied afterwards.
53+ ///
54+ /// # Safety
55+ ///
56+ /// `ccx_options` in C must be properly initialized and the logger must have
57+ /// been initialized via `ccxr_init_basic_logger` before calling this function.
58+ #[ no_mangle]
59+ pub unsafe extern "C" fn ccxr_update_logger_target ( ) {
60+ // CCX_MESSAGES_QUIET=0, CCX_MESSAGES_STDOUT=1, CCX_MESSAGES_STDERR=2
61+ let messages_target = match ccx_options. messages_target {
62+ 0 => OutputTarget :: Quiet ,
63+ 1 => OutputTarget :: Stdout ,
64+ 2 => OutputTarget :: Stderr ,
65+ _ => OutputTarget :: Stderr ,
66+ } ;
67+ if let Some ( mut logger) = logger_mut ( ) {
68+ logger. set_target ( messages_target) ;
69+ }
70+ }
71+
4972/// Rust equivalent for `verify_crc32` function in C. Uses C-native types as input and output.
5073///
5174/// # Safety
0 commit comments