-
Notifications
You must be signed in to change notification settings - Fork 155
Replace log crate with tracing in host code #1044
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
e1aca22
5d31424
d56aabf
f4dd6d2
d020eab
d435175
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Co-authored-by: dblnz <[email protected]>
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,12 @@ workspace = true | |
| [dependencies] | ||
| flatbuffers = { version = "25.9.23", default-features = false } | ||
| anyhow = { version = "1.0.100", default-features = false } | ||
| log = "0.4.28" | ||
| tracing = { version = "0.1.41", optional = true } | ||
| tracing = { version = "0.1.41" } | ||
| arbitrary = {version = "1.4.2", optional = true, features = ["derive"]} | ||
| spin = "0.10.0" | ||
|
|
||
| [features] | ||
| default = ["tracing"] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if we want to remove the #[instrument] condition from |
||
| default = [] | ||
| fuzzing = ["dep:arbitrary"] | ||
| trace_guest = [] | ||
| mem_profile = [] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,6 @@ use alloc::vec::Vec; | |
|
|
||
| use anyhow::{Error, Result, bail}; | ||
| use flatbuffers::{FlatBufferBuilder, WIPOffset, size_prefixed_root}; | ||
| #[cfg(feature = "tracing")] | ||
| use tracing::{Span, instrument}; | ||
|
|
||
| use super::function_types::{ParameterValue, ReturnType}; | ||
|
|
@@ -53,7 +52,7 @@ pub struct FunctionCall { | |
| } | ||
|
|
||
| impl FunctionCall { | ||
| #[cfg_attr(feature = "tracing", instrument(skip_all, parent = Span::current(), level= "Trace"))] | ||
| #[instrument(skip_all, parent = Span::current(), level= "Trace")] | ||
|
||
| pub fn new( | ||
| function_name: String, | ||
| parameters: Option<Vec<ParameterValue>>, | ||
|
|
@@ -214,7 +213,7 @@ impl FunctionCall { | |
| } | ||
| } | ||
|
|
||
| #[cfg_attr(feature = "tracing", instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace"))] | ||
| #[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")] | ||
| pub fn validate_guest_function_call_buffer(function_call_buffer: &[u8]) -> Result<()> { | ||
| let guest_function_call_fb = size_prefixed_root::<FbFunctionCall>(function_call_buffer) | ||
| .map_err(|e| anyhow::anyhow!("Error reading function call buffer: {:?}", e))?; | ||
|
|
@@ -226,7 +225,7 @@ pub fn validate_guest_function_call_buffer(function_call_buffer: &[u8]) -> Resul | |
| } | ||
| } | ||
|
|
||
| #[cfg_attr(feature = "tracing", instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace"))] | ||
| #[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")] | ||
| pub fn validate_host_function_call_buffer(function_call_buffer: &[u8]) -> Result<()> { | ||
| let host_function_call_fb = size_prefixed_root::<FbFunctionCall>(function_call_buffer) | ||
| .map_err(|e| anyhow::anyhow!("Error reading function call buffer: {:?}", e))?; | ||
|
|
@@ -240,7 +239,7 @@ pub fn validate_host_function_call_buffer(function_call_buffer: &[u8]) -> Result | |
|
|
||
| impl TryFrom<&[u8]> for FunctionCall { | ||
| type Error = Error; | ||
| #[cfg_attr(feature = "tracing", instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace"))] | ||
| #[instrument(err(Debug), skip_all, parent = Span::current(), level= "Trace")] | ||
| fn try_from(value: &[u8]) -> Result<Self> { | ||
| let function_call_fb = size_prefixed_root::<FbFunctionCall>(value) | ||
| .map_err(|e| anyhow::anyhow!("Error reading function call buffer: {:?}", e))?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied the suggestion and also added the
logfeature to maintain compatibility:tracing = { version = "0.1.41", default-features = false, features = [ "attributes", "log" ] }(d020eab)