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

Disable logs when using YT uploader? #547

Open
dideler opened this issue Apr 6, 2014 · 9 comments
Open

Disable logs when using YT uploader? #547

dideler opened this issue Apr 6, 2014 · 9 comments

Comments

@dideler
Copy link
Member

dideler commented Apr 6, 2014

Logs are appearing alongside the printed output of the YT uploader, hindering usability.

Are you sure you would like to upload these videos? [Y/n]
2014-04-06 13:54:28,866 (    INFO) apiclient.discovery                     : URL being requested: https://www.googleapis.com/discovery/v1/apis/youtube/v3/rest
2014-04-06 13:54:29,545 (    INFO) apiclient.discovery                     : URL being requested: https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&alt=json&part=snippet%2Cstatus
2014-04-06 13:54:29,546 (    INFO) freeseer.framework.youtube              : Uploading /home/dennis/Videos/TEST-UCOSPM.ogg
The file was successfully uploaded with video id: 1cdVYBk5aoY

Good for developers perhaps, completely unnecessary for users.

cc @MadMub

@MadMub
Copy link
Member

MadMub commented Apr 6, 2014

I was thinking of padding the success message with a line above and below so it sticks out more. Does freeseer not control the logging level for the installed version anyway?

@dideler
Copy link
Member Author

dideler commented Apr 6, 2014

I was thinking of padding the success message with a line above and below so it sticks out more.

Sure, give it a try and see how it looks.

Does freeseer not control the logging level for the installed version anyway?

I don't remember, @zxiiro can probably answer that quicker.

@MadMub to improve readability, we can also indent the list of videos found, that way it's easy to know that it "belongs" to the "Found videos" message at the top.

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

We use python's logger, but I think the uploader shouldn't even hook into the logger. It's unnecessary for a shell application.

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

To be clear the Youtube uploader has no dependencies on Freeseer and it's an independent too, even if it's started from the same CLI script. I think the uploader shouldn't be doing any log calls at all. Just use print statements.

@MadMub
Copy link
Member

MadMub commented Apr 7, 2014

The logging will then be removed completely, as I was instructed to not
make print statements in the API layer, which is why I made the youtube
frontend. I assumed for the deployed version of freeseer the logger is
turned off.
On Apr 6, 2014 8:54 PM, "Thanh Ha" [email protected] wrote:

To be clear the Youtube uploader has no dependencies on Freeseer and it's
an independent too, even if it's started from the same CLI script. I think
the uploader shouldn't be doing any log calls at all. Just use print
statements.

Reply to this email directly or view it on GitHubhttps://github.com//issues/547#issuecomment-39688887
.

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

No we don't do anything special with the deployed version. The logger used to be configurable then some people on the project decided allowing the user to configure the logger was too confusing so we removed that completely.

Logging is hard coded in this file [1].

[1] https://github.com/Freeseer/freeseer/blob/master/src/freeseer/__init__.py

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

Where does the logging get called for the uploader?

I don't see anywhere that we actually set it. Is this from an unmerged PR?

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

The apiclient.discovery log does not come from us. We can surpress it with a call to logging.getLogger("apiclient").setLevel(logging.INFO)

set logging.INFO to something that disables the log, I forget off the top of my head.

EDIT: Actually a better way is this:

logger = logging.getLogger('apiclient.discovery')
logger.propagate = False

EDIT2: You can leave logging in for debug purposes and disable it in the same way as my previous edit.

@zxiiro
Copy link
Member

zxiiro commented Apr 7, 2014

@MadMub Regarding print strings in the API layer, that's right you shouldn't be printing in the API layer. The API could pass messages back to it's caller though and let the caller decide what to do with it.

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

No branches or pull requests

3 participants