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

Consider using rust log instead of println #46

Closed
misos1 opened this issue Nov 14, 2018 · 1 comment
Closed

Consider using rust log instead of println #46

misos1 opened this issue Nov 14, 2018 · 1 comment

Comments

@misos1
Copy link

misos1 commented Nov 14, 2018

This would be more robust. Output can be controlled by users of lopdf crate or by users of crates which use lopdf.

https://crates.io/crates/log

There are nice println!-like macros:

  • trace!
  • debug!
  • info!
  • warn!
  • error!

Printing to stdout can hinder for example usage of lopdf in command line utilities. For example when someone create program to print number of pages to stdout and then want to use it in bash script (or as input to other CLI program) which will do something with that number pulled from stdout. This would hardly work for pdf files that triggers some lopdf warning.

It also looks nicer in code println!("Warning: {}", err) -> warn!("{}", err)

Or at least print to stderr using eprintln! or use conditional compilation and add feature to turn off printing to stdout.

@J-F-Liu
Copy link
Owner

J-F-Liu commented Mar 7, 2019

Fixed.

@J-F-Liu J-F-Liu closed this as completed Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants