-
Notifications
You must be signed in to change notification settings - Fork 309
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
aya-log: Add *max_level_*
filter features
#399
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
Add the following features for configuring the maximum log level available: * `max_level_off` * `max_level_error` * `max_level_warn` * `max_level_info` * `max_level_debug` * `max_level_trace` * `release_max_level_off` * `release_max_level_error` * `release_max_level_warn` * `release_max_level_info` * `release_max_level_debug` * `release_max_level_trace` Log invocations at disabled level will be skipped, which is especially beneficial for eBPF programs which are not going to send unneceessary logs through perf buffers. Features with `release_` prefix are used only in release builds. Those features have to applied on the userspace and eBPF crate separately. The correct thing to do is to set them on the same level. In case when userspace has higher maximum log level, it's not going to recieve the logs beyond the filter in eBPF crate. In the opposite situation, when eBPF crate has higher maximum level, it's going to waste cycles on sending logs through perf buffer, while they are not going to be displayed in the userspace. Signed-off-by: Michal Rostecki <[email protected]>
} else if let Some(level) = args.level { | ||
// Level was chosen by passing an argument to the log! macro. | ||
// We need to apply the max log level filter here. | ||
let level_str = format!("{:?}", level); |
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.
Instead of doing this, the Level
enum should be parseable from a TokenStream
(using syn::parse::Parse
), so we don't have to do this string hack
@vadorovsky, this pull request is now in conflict and requires a rebase. |
@vadorovsky, this pull request is now in conflict and requires a rebase. |
@vadorovsky, this pull request is now in conflict and requires a rebase. |
@vadorovsky do you intend to continue with this? I think it would be really great to have in aya-log 🙏 |
Add the following features for configuring the maximum log level available:
max_level_off
max_level_error
max_level_warn
max_level_info
max_level_debug
max_level_trace
release_max_level_off
release_max_level_error
release_max_level_warn
release_max_level_info
release_max_level_debug
release_max_level_trace
Log invocations at disabled level will be skipped, which is especially beneficial for eBPF programs which are not going to send unneceessary logs through perf buffers.
Features with
release_
prefix are used only in release builds.Those features have to applied on the userspace and eBPF crate separately. The correct thing to do is to set them on the same level. In case when userspace has higher maximum log level, it's not going to recieve the logs beyond the filter in eBPF crate. In the opposite situation, when eBPF crate has higher maximum level, it's going to waste cycles on sending logs through perf buffer, while they are not going to be displayed in the userspace.
Signed-off-by: Michal Rostecki [email protected]
This change is