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/commit.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/commit.rs')
| -rw-r--r-- | plugins/warp/src/plugin/commit.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/warp/src/plugin/commit.rs b/plugins/warp/src/plugin/commit.rs index 2af5fc3e..56a78f9a 100644 --- a/plugins/warp/src/plugin/commit.rs +++ b/plugins/warp/src/plugin/commit.rs @@ -6,6 +6,7 @@ use crate::plugin::create::OpenFileField; use binaryninja::binary_view::BinaryView; use binaryninja::command::Command; use binaryninja::interaction::{Form, FormInputField}; +use binaryninja::tracing; use warp::chunk::ChunkKind; use warp::WarpFile; @@ -84,11 +85,11 @@ impl CommitFile { let open_file_path = OpenFileField::from_form(&form)?; let source_id = source_field.from_form(&form)?; - log::info!("Committing file to source: {}", source_id); + tracing::info!("Committing file to source: {}", source_id); let bytes = std::fs::read(open_file_path).ok()?; let Some(warp_file) = WarpFile::from_bytes(&bytes) else { - log::error!("Failed to parse warp file!"); + tracing::error!("Failed to parse warp file!"); return None; }; @@ -103,7 +104,7 @@ impl CommitFile { match &chunk.kind { ChunkKind::Signature(sc) => { let functions: Vec<_> = sc.functions().collect(); - log::info!( + tracing::info!( "Adding {} functions to source: {}", functions.len(), source_id @@ -113,22 +114,22 @@ impl CommitFile { &source_id, &functions, ) { - log::error!("Failed to add functions to source: {}", e); + tracing::error!("Failed to add functions to source: {}", e); } } ChunkKind::Type(sc) => { let types: Vec<_> = sc.types().collect(); - log::info!("Adding {} types to source: {}", types.len(), source_id); + tracing::info!("Adding {} types to source: {}", types.len(), source_id); if let Err(e) = container.add_computed_types(&source_id, &types) { - log::error!("Failed to add types to source: {}", e); + tracing::error!("Failed to add types to source: {}", e); } } } } if let Err(e) = container.commit_source(&source_id) { - log::error!("Failed to commit source: {}", e); + tracing::error!("Failed to commit source: {}", e); } - log::info!("Committed file to source: {}", source_id); + tracing::info!("Committed file to source: {}", source_id); return Some(()); } } |
