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

Make log optional #141

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Make log optional #141

merged 2 commits into from
Oct 4, 2023

Conversation

not-fl3
Copy link
Contributor

@not-fl3 not-fl3 commented Sep 14, 2023

By default, with the "log" feature on "zune-core" will re-export the log crate.
Without "log", "zune-core" exports some stubs over eprintln!.
The only change required for "zune-*" crate: use zune_core::log::trace instead of log::trace.

To remove "log-rs" dependency in zune-image user's Cargo.toml:

zune-jpeg = {version = "0.3", default-features = false, features = ["x86", "neon", "std"]}

I do not really like that it requires "x86" etc, but I guess its fine? Not having log as a default featulre will be a breaking change - for everyone who actually used log-rs, all the logs from zune will suddenly disappear, not ideal.

Let me know if the idea is OK, I'll finish this PR with the rest of "zune-*" crates.

@etemesi254
Copy link
Owner

yea, it is ideal. I'm planning on a breaking change anyways since i switched from requiring slices for input to a generic trait T

@not-fl3
Copy link
Contributor Author

not-fl3 commented Sep 15, 2023

yea, it is ideal. I'm planning on a breaking change anyways since i switched from requiring slices for input to a generic trait T

perfect! pushed the rest of the crates with the "log" being off by default.

The only thing that concerned me - I changed log for zune_core in zune-imageprocs. Do not really know whats the relashionship between zune-imageprocs and zune_core and if that was a right thing to do.

@not-fl3 not-fl3 marked this pull request as ready for review September 15, 2023 19:41
@etemesi254
Copy link
Owner

The only thing that concerned me - I changed log for zune_core in zune-imageprocs. Do not really know whats the relashionship between zune-imageprocs and zune_core and if that was a right thing to do.

The reason it never used zune-core was that there was no need for them to interact.

The imageprocs does image processing stuff- blurs, color manipulation etc. core mainly provides decoding and encoding routines like byte readers and writers.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm not particularly okay with printing to standard output. I.e it's a library and it wouldn't make sense to print warnings for something we can't really influence where it would be used.

I think if the user doesn't want logging, let us just silently fail

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done! warn and error are now panic and anything else is just nothing.

tbh as a user I would not mind info! and warn! to go into stderr

@etemesi254 etemesi254 merged commit f0a87e7 into etemesi254:dev Oct 4, 2023
9 of 12 checks passed
etemesi254 added a commit that referenced this pull request Oct 21, 2023
Make log optional
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.

2 participants