wasi-common: switch all logs from log to tracing
tracing is already the dep that wiggle uses. I used tracing structured arguments wherever I could, but I skipped over it in all of the snapshot_0 code, because I'm going to delete that code and replace it with wiggle-based stuff real soon.
This commit is contained in:
@@ -5,9 +5,9 @@ use crate::wasi::wasi_snapshot_preview1::WasiSnapshotPreview1;
|
||||
use crate::wasi::{types, AsBytes, Errno, Result};
|
||||
use crate::WasiCtx;
|
||||
use crate::{path, poll};
|
||||
use log::{debug, error, trace};
|
||||
use std::convert::TryInto;
|
||||
use std::io::{self, SeekFrom};
|
||||
use tracing::{debug, error, trace};
|
||||
use wiggle::{GuestPtr, GuestSlice};
|
||||
|
||||
impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
@@ -651,7 +651,7 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
true,
|
||||
)?;
|
||||
let old_path = old_path.as_str()?;
|
||||
trace!(" | old_path='{}'", &*old_path);
|
||||
trace!(old_path = &*old_path);
|
||||
new_fd.symlink(&old_path, &new_path)
|
||||
}
|
||||
|
||||
@@ -701,8 +701,11 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
match subscription.u {
|
||||
types::SubscriptionU::Clock(clock) => {
|
||||
let delay = clock::to_relative_ns_delay(&clock)?;
|
||||
debug!("poll_oneoff event.u.clock = {:?}", clock);
|
||||
debug!("poll_oneoff delay = {:?}ns", delay);
|
||||
debug!(
|
||||
clock = tracing::field::debug(&clock),
|
||||
delay_ns = tracing::field::debug(delay),
|
||||
"poll_oneoff"
|
||||
);
|
||||
let current = poll::ClockEventData {
|
||||
delay,
|
||||
userdata: subscription.userdata,
|
||||
@@ -766,8 +769,11 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
}
|
||||
}
|
||||
}
|
||||
debug!("poll_oneoff events = {:?}", events);
|
||||
debug!("poll_oneoff timeout = {:?}", timeout);
|
||||
debug!(
|
||||
events = tracing::field::debug(&events),
|
||||
timeout = tracing::field::debug(timeout),
|
||||
"poll_oneoff"
|
||||
);
|
||||
// The underlying implementation should successfully and immediately return
|
||||
// if no events have been passed. Such situation may occur if all provided
|
||||
// events have been filtered out as errors in the code above.
|
||||
@@ -780,7 +786,7 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
event_ptr.write(event)?;
|
||||
}
|
||||
|
||||
trace!(" | *nevents={:?}", nevents);
|
||||
trace!(nevents = nevents);
|
||||
|
||||
Ok(nevents)
|
||||
}
|
||||
@@ -803,7 +809,7 @@ impl<'a> WasiSnapshotPreview1 for WasiCtx {
|
||||
fn random_get(&self, buf: &GuestPtr<u8>, buf_len: types::Size) -> Result<()> {
|
||||
let mut slice = buf.as_array(buf_len).as_slice()?;
|
||||
getrandom::getrandom(&mut *slice).map_err(|err| {
|
||||
error!("getrandom failure: {:?}", err);
|
||||
error!(error = tracing::field::display(err), "getrandom failure");
|
||||
Errno::Io
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user