summaryrefslogtreecommitdiff
path: root/plugins/warp/src/container/network.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/warp/src/container/network.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/warp/src/container/network.rs')
-rw-r--r--plugins/warp/src/container/network.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/warp/src/container/network.rs b/plugins/warp/src/container/network.rs
index d0ccd3ea..0908b103 100644
--- a/plugins/warp/src/container/network.rs
+++ b/plugins/warp/src/container/network.rs
@@ -3,6 +3,7 @@ use crate::container::{
Container, ContainerError, ContainerResult, ContainerSearchQuery, ContainerSearchResponse,
SourceId, SourcePath, SourceTag,
};
+use binaryninja::tracing;
use directories::ProjectDirs;
use std::collections::{HashMap, HashSet};
use std::fmt::{Debug, Display, Formatter};
@@ -102,7 +103,7 @@ impl NetworkContainer {
guids: &[FunctionGUID],
) -> HashMap<SourceId, Vec<FunctionGUID>> {
let Some(target_id) = target.and_then(|t| self.get_target_id(t)) else {
- log::debug!("Cannot query functions source without a target, skipping...");
+ tracing::debug!("Cannot query functions source without a target, skipping...");
return HashMap::new();
};
@@ -122,7 +123,7 @@ impl NetworkContainer {
{
Ok(queried_results) => queried_results,
Err(e) => {
- log::error!("Failed to query functions source: {}", e);
+ tracing::error!("Failed to query functions source: {}", e);
return result;
}
};
@@ -170,12 +171,12 @@ impl NetworkContainer {
{
Ok(file) => file,
Err(e) => {
- log::error!("Failed to query functions: {}", e);
+ tracing::error!("Failed to query functions: {}", e);
return;
}
};
- log::debug!("Got {} chunks from server", file.chunks.len());
+ tracing::debug!("Got {} chunks from server", file.chunks.len());
for chunk in &file.chunks {
match &chunk.kind {
ChunkKind::Signature(sc) => {
@@ -183,12 +184,12 @@ impl NetworkContainer {
// Probe the source before attempting to access it, as it might not exist locally.
self.probe_source(*source);
match self.cache.add_functions(target, source, &functions) {
- Ok(_) => log::debug!(
+ Ok(_) => tracing::debug!(
"Added {} functions into cached source '{}'",
functions.len(),
source
),
- Err(err) => log::error!(
+ Err(err) => tracing::error!(
"Failed to add {} function into cached source '{}': {}",
functions.len(),
source,
@@ -227,7 +228,7 @@ impl NetworkContainer {
let _ = self.cache.insert_source(source_id, SourcePath(source_path));
}
Err(e) => {
- log::error!("Failed to probe source '{}': {}", source_id, e);
+ tracing::error!("Failed to probe source '{}': {}", source_id, e);
}
}
}