summaryrefslogtreecommitdiff
path: root/plugins/pdb-ng/src/lib.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-12-17 21:23:46 -0500
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-01-11 10:36:01 -0800
commit168a3fd34824adc9c6a606cd144219701f15cccf (patch)
tree9bbac31ece5ea6ab6627998d995a77f7f7e2f8e6 /plugins/pdb-ng/src/lib.rs
parentca91bc1933976c62d24248f0f7c35af38451ff11 (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/pdb-ng/src/lib.rs')
-rw-r--r--plugins/pdb-ng/src/lib.rs25
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/pdb-ng/src/lib.rs b/plugins/pdb-ng/src/lib.rs
index d7eb2524..5bbbb53e 100644
--- a/plugins/pdb-ng/src/lib.rs
+++ b/plugins/pdb-ng/src/lib.rs
@@ -21,15 +21,14 @@ use std::sync::mpsc;
use std::{env, fs};
use anyhow::{anyhow, Result};
-use log::{debug, error, info};
use pdb::PDB;
use binaryninja::binary_view::{BinaryView, BinaryViewBase, BinaryViewExt};
use binaryninja::debuginfo::{CustomDebugInfoParser, DebugInfo, DebugInfoParser};
use binaryninja::download::{DownloadInstanceInputOutputCallbacks, DownloadProvider};
use binaryninja::interaction::{MessageBoxButtonResult, MessageBoxButtonSet};
-use binaryninja::logger::Logger;
use binaryninja::settings::{QueryOptions, Settings};
+use binaryninja::tracing::{debug, error, info};
use binaryninja::{interaction, user_directory};
use parser::PDBParserInstance;
@@ -436,7 +435,9 @@ impl PDBParser {
Ok(_) => {
info!("Downloaded to: {}", cab_path.to_string_lossy());
}
- Err(e) => error!("Could not write PDB to cache: {}", e),
+ Err(e) => {
+ error!("Could not write PDB to cache: {}", e)
+ }
}
}
@@ -471,7 +472,9 @@ impl PDBParser {
Ok(_) => {
info!("Downloaded to: {}", cab_path.to_string_lossy());
}
- Err(e) => error!("Could not write PDB to cache: {}", e),
+ Err(e) => {
+ error!("Could not write PDB to cache: {}", e)
+ }
}
}
}
@@ -588,7 +591,9 @@ impl CustomDebugInfoParser for PDBParser {
}
}
Ok(None) => {}
- e => error!("Error searching symbol store {}: {:?}", store, e),
+ e => {
+ error!("Error searching symbol store {}: {:?}", store, e)
+ }
}
}
}
@@ -649,7 +654,9 @@ impl CustomDebugInfoParser for PDBParser {
Err(e) => debug!("Skipping, {}", e.to_string()),
},
Err(e) if e.to_string() == "Cancelled" => return false,
- Err(e) => debug!("Could not read pdb: {}", e.to_string()),
+ Err(e) => {
+ debug!("Could not read pdb: {}", e.to_string())
+ }
}
}
}
@@ -690,7 +697,9 @@ impl CustomDebugInfoParser for PDBParser {
}
}
Ok(None) => {}
- e => error!("Error searching remote symbol server {}: {:?}", server, e),
+ e => {
+ error!("Error searching remote symbol server {}: {:?}", server, e)
+ }
}
}
}
@@ -718,7 +727,7 @@ pub extern "C" fn PDBPluginInit() -> bool {
}
fn init_plugin() -> bool {
- Logger::new("PDB").init();
+ binaryninja::tracing_init!("PDB Import");
DebugInfoParser::register("PDB", PDBParser {});
let settings = Settings::new();