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/function.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/function.rs')
| -rw-r--r-- | plugins/warp/src/plugin/function.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/warp/src/plugin/function.rs b/plugins/warp/src/plugin/function.rs index 6202f9d7..3c0dc06c 100644 --- a/plugins/warp/src/plugin/function.rs +++ b/plugins/warp/src/plugin/function.rs @@ -10,6 +10,7 @@ use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::{Command, FunctionCommand}; use binaryninja::function::{Function, FunctionUpdateType}; use binaryninja::rc::Guard; +use binaryninja::tracing; use rayon::iter::ParallelIterator; use std::thread; use warp::signature::function::FunctionGUID; @@ -24,7 +25,7 @@ impl FunctionCommand for IncludeFunction { let insert_tag_type = get_warp_include_tag_type(view); match should_add_tag { true => { - log::info!( + tracing::info!( "Including selected function '{}' at 0x{:x}", sym_name_str, func.start() @@ -32,7 +33,7 @@ impl FunctionCommand for IncludeFunction { func.add_tag(&insert_tag_type, "", None, false, None); } false => { - log::info!( + tracing::info!( "Removing included function '{}' at 0x{:x}", sym_name_str, func.start() @@ -58,7 +59,7 @@ impl FunctionCommand for IgnoreFunction { let ignore_tag_type = get_warp_ignore_tag_type(view); match should_add_tag { true => { - log::info!( + tracing::info!( "Ignoring function for matching '{}' at 0x{:x}", sym_name_str, func.start() @@ -66,7 +67,7 @@ impl FunctionCommand for IgnoreFunction { func.add_tag(&ignore_tag_type, "", None, false, None); } false => { - log::info!( + tracing::info!( "Including function for matching '{}' at 0x{:x}", sym_name_str, func.start() @@ -87,7 +88,7 @@ impl FunctionCommand for RemoveFunction { fn action(&self, _view: &BinaryView, func: &Function) { let sym_name = func.symbol().short_name(); let sym_name_str = sym_name.to_string_lossy(); - log::info!( + tracing::info!( "Removing matched function '{}' at 0x{:x}", sym_name_str, func.start() @@ -107,10 +108,10 @@ pub struct CopyFunctionGUID; impl FunctionCommand for CopyFunctionGUID { fn action(&self, _view: &BinaryView, func: &Function) { let Some(guid) = cached_function_guid(func, || func.lifted_il().ok()) else { - log::error!("Could not get guid for copied function"); + tracing::error!("Could not get guid for copied function"); return; }; - log::info!( + tracing::info!( "Function GUID for {:?}... {}", func.symbol().short_name(), guid @@ -137,11 +138,11 @@ impl Command for FindFunctionFromGUID { }; let Ok(searched_guid) = guid_str.parse::<FunctionGUID>() else { - log::error!("Failed to parse function guid... {}", guid_str); + tracing::error!("Failed to parse function guid... {}", guid_str); return; }; - log::info!("Searching functions for GUID... {}", searched_guid); + tracing::info!("Searching functions for GUID... {}", searched_guid); let funcs = view.functions(); let view = view.to_owned(); thread::spawn(move || { @@ -159,7 +160,7 @@ impl Command for FindFunctionFromGUID { .collect(); if matched.is_empty() { - log::info!("No matches found for GUID... {}", searched_guid); + tracing::info!("No matches found for GUID... {}", searched_guid); } else { for func in &matched { // Also navigate the user, as that is probably what they want. @@ -170,14 +171,14 @@ impl Command for FindFunctionFromGUID { .navigate_to(¤t_view, func.start()) .is_err() { - log::error!( + tracing::error!( "Failed to navigate to found function 0x{:0x} in view {}", func.start(), current_view ); } } - log::info!("Match found at function... 0x{:0x}", func.start()); + tracing::info!("Match found at function... 0x{:0x}", func.start()); } } |
