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

Apply env_logger module filters on Dart & UniFFI binding loggers #874

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

Conversation

erdemyerebasmaz
Copy link
Contributor

@erdemyerebasmaz erdemyerebasmaz commented Mar 19, 2024

This PR addresses the issue where env_logger's module filters were not applying to logs listened through Dart & UniFFI binding loggers.

Changelist:

  • Filter Dart & UniFFI binding logs through env_logger module filters
  • Move loggers under logger.rs
  • Make filter levels customizable for each logger
  • Log node-logs according to their level
  • Apply changes to bindings & generate them
    • Create LevelFilter struct that's usable from bindings.
    • Add optional filter_level param to binding logger init & setters
    • Map models:LevelFilter to log::LevelFilter.
      • Set LevelFilter::TRACE as default filter level

TODO:

@erdemyerebasmaz
Copy link
Contributor Author

Depends on:

});
}

pub struct UniFFILogger {
Copy link
Member

Choose a reason for hiding this comment

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

Why taking the specific loggers out of their specific crates?
Doesn't UniFFILogger belong to the sdk-bindings crate?

Copy link
Contributor Author

@erdemyerebasmaz erdemyerebasmaz Mar 27, 2024

Choose a reason for hiding this comment

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

Not necessarily, the loggers are not exposed through bindings.

I had brought them together to see the differences to find the root cause of the issue, and I prefer having them together, but we can bring them back to uniffi_bindings.rs & bindings.rs with little to no change.

If we expand upon logger settings as mentioned on #892, it would be hard to miss applying new changes on bindings when they are grouped together like this.

Dart, UniFFI & GlobalSDK logger's are moved under logger.rs

.
- Create LevelFilter struct that's usable from bindings.
- Add optional filter_level param to binding logger init & setters
- Map models:LevelFilter to log::LevelFilter.
  - Set LevelFilter::TRACE as default filter level
Log `UNUSUAL` level node logs at `Error` level
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.

Print logs from Dart & UniFFI binding loggers on LogCat & OSLog
2 participants