Use aya_log_ebpf::ufmt instead of ::ufmt

pull/350/head
Alessandro Decina 3 years ago committed by Dave Tucker
parent 0d7ac3eb3e
commit 741957f945

@ -23,7 +23,6 @@ Add `aya-log-ebpf` and `ufmt` to `Cargo.toml`:
```toml ```toml
[dependencies] [dependencies]
aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" } aya-log-ebpf = { git = "https://github.com/aya-rs/aya-log", branch = "main" }
ufmt = "0.1"
``` ```
## Example ## Example

@ -1,5 +1,7 @@
#![no_std] #![no_std]
pub extern crate ufmt;
mod macros; mod macros;
use core::{cmp, mem, ptr}; use core::{cmp, mem, ptr};

@ -195,7 +195,8 @@ macro_rules! log {
#[macro_export] #[macro_export]
macro_rules! write_record_message { macro_rules! write_record_message {
($buf:expr, $($arg:tt)+) => {{ ($buf:expr, $($arg:tt)+) => {{
use aya_log_ebpf::ufmt;
let mut writer = $crate::LogBufWriter::new($buf); let mut writer = $crate::LogBufWriter::new($buf);
ufmt::uwrite!(writer, $($arg)+).map(|_| writer.finish()) aya_log_ebpf::ufmt::uwrite!(writer, $($arg)+).map(|_| writer.finish())
}} }}
} }

@ -167,6 +167,7 @@ fn log_buf(mut buf: &[u8], logger: &dyn Log) -> Result<(), ()> {
.line(line) .line(line)
.build(), .build(),
); );
logger.flush();
Ok(()) Ok(())
} }

Loading…
Cancel
Save