Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Do not log progress bar to stderr #151

Closed
stellarhoof opened this issue Sep 26, 2018 · 6 comments
Closed

Do not log progress bar to stderr #151

stellarhoof opened this issue Sep 26, 2018 · 6 comments

Comments

@stellarhoof
Copy link
Contributor

Our application emails devs when some program logs to stderr. Right now I can override pyppeteer's root logger to my needs. However https://github.com/stellarhoof/pyppeteer/blob/dev/pyppeteer/chromium_downloader.py#L85 uses stderr by default. Could we customize this? At the very least we could try and reuse the first stream handler that the logger at https://github.com/stellarhoof/pyppeteer/blob/dev/pyppeteer/chromium_downloader.py#L19 has. That way customizations that clients of your library do to your logger carry over.
What do you think?

@miyakogi
Copy link
Owner

I've just taken a look at the source of tqdm, it's hard coded and no option to control this behavior.
If you don't need log on installation process, how about separating installation and your script like:

pyppeteer-install 1>/dev/null 2>&1
python your-script.py

@stellarhoof
Copy link
Contributor Author

stellarhoof commented Sep 26, 2018

I think you can pass it a file argument
(https://github.com/tqdm/tqdm/blob/master/tqdm/_tqdm.py#L647). The default is stderr (https://github.com/tqdm/tqdm/blob/master/tqdm/_tqdm.py#L751)

Unfortunately your suggestion doesn't completely solve the problem since I cannot change how our scripts are run. Additionally, the download process gets triggered often (which I have to investigate) so installing at the beginning will not stop the other downloads (we run the scripts periodically)

@miyakogi
Copy link
Owner

Do you want to record progress bar to a log file?

@miyakogi
Copy link
Owner

Adding option to launch function may solve this issue, but I'm sorry but I don't implement for this as I think your requirement is so specific on your use case.
PRs are welcome.

@stellarhoof
Copy link
Contributor Author

Ok I will make a proof of concept PR and you decide.

@stellarhoof
Copy link
Contributor Author

stellarhoof commented Sep 27, 2018

Actually it might be better to make an issue upstream to tqdm.

Edit: tqdm/tqdm#619

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants