-
Notifications
You must be signed in to change notification settings - Fork 267
[Rust] Replace log with tracing
#7808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
emesare
wants to merge
6
commits into
dev
Choose a base branch
from
test_rust_tracing
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
Author
|
Resolves #6863 |
- 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.
76a789c to
93aa1a8
Compare
Member
Author
|
Force pushed removing explicit targets in log calls, replaced with rewrite rules within the registered tracing |
…ary view callbacks
Would be really nice if we consolidated this somewhere so this does not keep happening
f151812 to
9717943
Compare
Member
Author
|
Migration guide:
diff --git a/plugins/pdb-ng/Cargo.toml b/plugins/pdb-ng/Cargo.toml
--- a/plugins/pdb-ng/Cargo.toml
+++ b/plugins/pdb-ng/Cargo.toml
@@ -16,1 +16,2 @@
regex = "1"
+tracing = "0.1"
diff --git a/plugins/warp/src/plugin/load.rs b/plugins/warp/src/plugin/load.rs
--- a/plugins/warp/src/plugin/load.rs
+++ b/plugins/warp/src/plugin/load.rs
@@ -132,4 +133,4 @@
Err(e) => {
- log::error!("Failed to read signature file: {}", e);
+ tracing::error!("Failed to read signature file: {}", e);
return;
}
diff --git a/plugins/pdb-ng/src/lib.rs b/plugins/pdb-ng/src/lib.rs
--- a/plugins/pdb-ng/src/lib.rs
+++ b/plugins/pdb-ng/src/lib.rs
@@ -721,1 +729,1 @@
- Logger::new("PDB").init();
+ binaryninja::tracing_init!("PDB Import"); |
Assign the `session_id` span field before calling into the relocation handler so logs get scoped to the specific view.
087f6f9 to
77ebe1b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explicitly name the target for the log event, this is how it must be done to guarantee we send it to the correct onesession_idevent field, to send logs to a particular session (e.g. binary view scoped logs)This is a breaking change, but I believe there is no better time to make it, we cannot continue to use the
logcrate, it is too limited for our needs.Still need to finish docs and cross link more between theloggermodule and thetracingmodule, as well as provide some examples in the top level module docs.Still need to place more session id spans in relevant callbacks so that they automatically get scoped to a bv.TBD if we keep the tracing re-exports for the macros, we might instead let callers use the non re-exported version. or we might move the code intologgerand then re-export tracing at the top level, or we might not re-export at all and assume the caller includestracingin Cargo.toml.