-
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 3 commits
e1aca22
5d31424
d56aabf
f4dd6d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
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 |
|---|---|---|
|
|
@@ -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.
I am not sure if we want to remove the #[instrument] condition from
hyperlight-common. But, considering the hyperlight guests can now use the same tracing crate as the host, I think this would be fine