get-pytube / pytube3

A lightweight, dependency-free Python 3 library (and command-line utility) for downloading YouTube Videos.
https://pytube3.readthedocs.io
Other
178 stars 55 forks source link

"download remaining" consumes log file #73

Open Hiltronix opened 4 years ago

Hiltronix commented 4 years ago

Hello,

This is a great project, and thank you for sharing it with us. I'm using pytube3 in one of my apps, and it works great.

I really appreciate the "on_progress" function. But I have an issue with the "on_progress" function when it comes to logging. Pytube uses the default logger, and that's ideal. However, "on_progress" in "streams.py" writes to the log on ever call, simply to show the remaining download. When downloading a YouTube video, this means that each video download writes hundreds and hundreds of lines to the log file, pushing all other log entries out in the process. I see little value in seeing hundreds or even thousands of lines of:

2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58425494 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58421398 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58417302 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58413206 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58409110 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58405014 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58400918 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58396822 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58392726 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58388630 2020-03-26 12:31:32,pytube.streams,DEBUG,Func:on_progress,download remaining: 58384534

and then not having the debug lines of the errors I'm looking for from other modules, cause they have been purged from the log as it rolls over.

Personally I don't think this should be logged at all. I'm sure that's debatable, perhaps someone has a use-case for seeing this in the log, but I don't, as it purges useful log info, with no gain (in my opinion.)

I'd like to request that line 300 of streams.py be commented out, or removed.

    logger.debug("download remaining: %s", bytes_remaining)

Or at the very least, perhaps an option needs to be set to activate it or deactivate it, if you feel it's important to have.

I just don't feel that a single module of a project should be able to dominate 90% of a log file with info that has very limited usefulness, leaving no log space for much else.

Thanks for your consideration, and thanks again for the project!

swiftyy-mage commented 4 years ago

Good point, I'll take a look at this. Thanks for the feedback.