-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
don't log to stdout if not cli #708
base: master
Are you sure you want to change the base?
Conversation
Running CI now, this PR looks cool 🔥 |
e144fe2
to
b3923d7
Compare
@bee-san didn't catch the clippy warning because my clippy was not updated. I fixed the error, please try running CI again :) |
I am also thinking about whether or not it's worth testing for this. We could write a test similar to https://github.com/RustScan/RustScan/blob/master/tests/timelimits.rs that runs rustscan as the api (2 files?) and if it logs to stdout, the test fails 🤔 |
@bee-san I added a test to check if library outputs to stdout, I used an unstable feature for tests only. The other options I thought of:
|
The ci is failing because
This is because the CI uses the stable release channel of Rust, may need to update the workflow :) Thanks so much for the test!! |
db0992c
to
42eff43
Compare
@bee-san Because I can't use unstable rust, I created a rust example to test, I used example to avoid having binaries that could be confused for the actual program. Simple explanation about how examples work in rust. I actually read the complete Sorry for delay, I was a bit crunched this week so took me a while to respond. |
It's okay! It's open source, take as long as you need. With that in mind, I'd need to read the docs on some of these functions. Give me a bit of time :) |
This PR is a proposal to solve #706. I understand there are a lot of ways to do this so I just tried a simple approach.
I did this by adding a static boolean that will be set to true in
main.rs
making the program output to stdout (current behavior). Otherwise (if boolean is not set) the old logs will uselog::$level
.I used
#[doc(hidden)]
attribute to avoid flooding the API documentation with print related utilities.Extra: removed once_cell dependency