You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aya/aya-log/ebpf/example/src/main.rs

23 lines
679 B
Rust

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#![no_std]
#![no_main]
use aya_bpf::{macros::tracepoint, programs::TracePointContext, BpfContext};
use aya_log_ebpf::{debug, error, info, trace, warn};
#[tracepoint]
pub fn example(ctx: TracePointContext) -> u32 {
error!(&ctx, "this is an error message 🚨");
warn!(&ctx, "this is a warning message ⚠️");
info!(&ctx, "this is an info message ");
debug!(&ctx, "this is a debug message ️🐝");
trace!(&ctx, "this is a trace message 🔍");
let pid = ctx.pid();
info!(&ctx, "a message with args PID: {}", pid);
0
}
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
unsafe { core::hint::unreachable_unchecked() }
}