Skip to content

Env logger feature #3775

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

mcmah309
Copy link
Contributor

Closes #3774

@mcmah309 mcmah309 requested a review from a team as a code owner February 20, 2025 18:44
Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

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

If we support the env filter, then we should support it for all our platforms:

  • mac
  • win
  • linux
  • ios
  • android
  • web

The last three are the hardest but definitely quite important.

I believe for ios and android we just need to re-export the RUST_LOG env var into the spawned processes:

https://github.com/DioxusLabs/dioxus/blob/main/packages/cli/src/serve/handle.rs#L78-L109

For these two platforms, env vars don't automatically inherit, so they have their own bespoke methods for receiving env.

For WASM, I'd like us to invent a way of passing env vars into wasm (allowing env::var in WASM) but that's outside the scope of this PR, so it's fine to leave WASM unimplemented.

I would also like to make this the default behavior of the logger. We probably don't need to feature-gate it and instead just make the dioxus_logger crate runtime configurable instead.

@mcmah309
Copy link
Contributor Author

mcmah309 commented Apr 5, 2025

Logging on android seems to be broken, so I could not get it to work there #3971 and I did not test IOS

@mcmah309 mcmah309 requested a review from jkelleyrtp April 9, 2025 01:28
Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

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

Awesome! I think we might have a conflict with dx serve and the child colliding since both rely on env logging, but that shouldn't be a huge issue

Edit: can you fix the clippy error?

@jkelleyrtp jkelleyrtp self-requested a review April 9, 2025 17:52
Copy link
Member

@jkelleyrtp jkelleyrtp left a comment

Choose a reason for hiding this comment

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

clippy!

@mcmah309 mcmah309 force-pushed the env_logger_feature branch from a59207e to 6812378 Compare April 10, 2025 07:54
@mcmah309 mcmah309 requested a review from jkelleyrtp April 10, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dioxus Logger Env Filtering
2 participants