Skip to content
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

Update VerifierLogLevel to use bitflags #376

Merged
merged 3 commits into from
Sep 6, 2022

Conversation

conectado
Copy link
Contributor

As talked with @alessandrod here, using bitflags! to implement the VerifierLogLevel.

I think that using the Default trait might be better than having a DEFAULT value in the struct but not so sure on that.

Also setting Level2 as Level1 | 2 since in the kernel level 1 seems to imply level 2. Meaning, that when they check for log level they either check for BPF_LOG_LEVEL2 (when it's exclusive to 2) or BPF_LOG_LEVEL when it also include level 1, So I didn't think being able to use 2 was very useful.

@netlify
Copy link

netlify bot commented Sep 1, 2022

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3bed2c2
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6317c5880872310008cdbb4c
😎 Deploy Preview https://deploy-preview-376--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

aya/src/bpf.rs Outdated
/// Used to disable all logging.
const DISABLE = 0;
/// Logs tracing with details level 1
const LEVEL1 = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be DEBUG

Copy link
Collaborator

@alessandrod alessandrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops sorry I forgot to review this last week!

See comments - I still think that LEVEL1 and LEVEL2 are bad names (as you discovered, LEVEL2 implies LEVEL1 anyway). I think we should use DEBUG and VERBOSE.

aya/src/bpf.rs Outdated
/// Logs tracing with details level 1
const LEVEL1 = 1;
/// Log tracing with details level 2
const LEVEL2 = 2 | Self::LEVEL1.bits;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be VERBOSE

@conectado
Copy link
Contributor Author

agreed! those are better names

Copy link
Collaborator

@alessandrod alessandrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thank you!

aya/src/bpf.rs Outdated
const DEBUG = 1;
/// Enables verbose verifier logging.
const VERBOSE = 2 | Self::DEBUG.bits;
/// Enables verifier stats
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing period at the end of the sentence

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@conectado oops just noticed this - could you fix it pls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry didn't see this message, right away

@alessandrod alessandrod merged commit fe22b02 into aya-rs:main Sep 6, 2022
@dave-tucker dave-tucker added fix A PR that is a small change or fixes a bug aya This is about aya (userspace) labels Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya This is about aya (userspace) fix A PR that is a small change or fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants