diff options
| author | Mason Reed <mason@vector35.com> | 2025-12-17 21:23:46 -0500 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-01-11 10:36:01 -0800 |
| commit | 168a3fd34824adc9c6a606cd144219701f15cccf (patch) | |
| tree | 9bbac31ece5ea6ab6627998d995a77f7f7e2f8e6 /plugins/warp/src/plugin/workflow.rs | |
| parent | ca91bc1933976c62d24248f0f7c35af38451ff11 (diff) | |
[Rust] Replace `log` with `tracing`
- Added more documentation
- Replaced global named logger for plugins, fixing the issue when the CU has multiple (e.g. statically linked demo)
- Simplified some misc code
This is a breaking change, but I believe there is no better time to make it, we cannot continue to use the `log` crate, it is too limited for our needs.
Diffstat (limited to 'plugins/warp/src/plugin/workflow.rs')
| -rw-r--r-- | plugins/warp/src/plugin/workflow.rs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs index e5ce9b76..a51c7399 100644 --- a/plugins/warp/src/plugin/workflow.rs +++ b/plugins/warp/src/plugin/workflow.rs @@ -15,6 +15,7 @@ use binaryninja::command::Command; use binaryninja::function::Function as BNFunction; use binaryninja::rc::Ref as BNRef; use binaryninja::settings::{QueryOptions, Settings}; +use binaryninja::tracing; use binaryninja::workflow::{activity, Activity, AnalysisContext, Workflow, WorkflowBuilder}; use dashmap::DashSet; use itertools::Itertools; @@ -39,7 +40,7 @@ impl Command for RunMatcher { // Alert the user if we have no actual regions (+1 comes from the synthetic section). let regions = relocatable_regions(&view); if regions.len() <= 1 && view.memory_map().is_activated() { - log::warn!( + tracing::warn!( "No relocatable regions found, for best results please define sections for the binary!" ); } @@ -90,13 +91,15 @@ impl FunctionSet { .workflow() .expect("Function has no workflow"); if function_workflow.contains(GUID_ACTIVITY_NAME) { - log::error!("No function guids in database, please reanalyze the database."); + tracing::error!( + "No function guids in database, please reanalyze the database." + ); } else { - log::error!( - "Activity '{}' is not in workflow '{}', create function guids manually to run matcher...", - GUID_ACTIVITY_NAME, - function_workflow.name() - ) + tracing::error!( + "Activity '{}' is not in workflow '{}', create function guids manually to run matcher...", + GUID_ACTIVITY_NAME, + function_workflow.name() + ) } } return None; @@ -169,7 +172,7 @@ pub fn run_matcher(view: &BinaryView) { .maximum_possible_functions .is_some_and(|max| max < matched_functions.len() as u64) { - log::warn!( + tracing::warn!( "Skipping {}, too many possible functions: {}", guid, matched_functions.len() @@ -244,10 +247,10 @@ pub fn run_matcher(view: &BinaryView) { } if background_task.is_cancelled() { - log::info!("Matcher was cancelled by user, you may run it again by running the 'Run Matcher' command."); + tracing::info!("Matcher was cancelled by user, you may run it again by running the 'Run Matcher' command."); } - log::info!( + tracing::info!( "Function matching took {:.3} seconds and matched {} functions after {} rounds", start.elapsed().as_secs_f64(), matcher_results.len(), @@ -290,12 +293,12 @@ pub fn run_fetcher(view: &BinaryView) { }); if background_task.is_cancelled() { - log::info!( + tracing::info!( "Fetcher was cancelled by user, you may run it again by running the 'Fetch' command." ); } - log::info!("Fetching took {:?}", start.elapsed()); + tracing::info!("Fetching took {:?}", start.elapsed()); background_task.finish(); } |
