diff --git a/frontends/ycdl_flask/backend/common.py b/frontends/ycdl_flask/backend/common.py index 6af2861..8d36da6 100644 --- a/frontends/ycdl_flask/backend/common.py +++ b/frontends/ycdl_flask/backend/common.py @@ -2,9 +2,6 @@ Do not execute this file directly. Use ycdl_launch.py to start the server with gevent. ''' -import logging -logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR) - import flask; from flask import request import mimetypes import os diff --git a/frontends/ycdl_flask/ycdl_flask_launch.py b/frontends/ycdl_flask/ycdl_flask_launch.py index ac4778b..77eda8b 100644 --- a/frontends/ycdl_flask/ycdl_flask_launch.py +++ b/frontends/ycdl_flask/ycdl_flask_launch.py @@ -1,5 +1,8 @@ import logging -logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.ERROR) +logging.basicConfig() +logging.getLogger('ycdl.ycdldb').setLevel(logging.DEBUG) +logging.getLogger('ycdl.ytapi').setLevel(logging.DEBUG) +logging.getLogger('ycdl.ytrss').setLevel(logging.DEBUG) import gevent.monkey gevent.monkey.patch_all() diff --git a/frontends/ycdl_repl.py b/frontends/ycdl_repl.py index 6f936cc..10c6367 100644 --- a/frontends/ycdl_repl.py +++ b/frontends/ycdl_repl.py @@ -2,6 +2,11 @@ Run `python -i ycdl_repl.py to get an interpreter session with these variables preloaded. ''' +import logging +logging.basicConfig() +logging.getLogger('ycdl.ycdldb').setLevel(logging.DEBUG) +logging.getLogger('ycdl.ytapi').setLevel(logging.DEBUG) +logging.getLogger('ycdl.ytrss').setLevel(logging.DEBUG) import bot import ycdl diff --git a/utilities/download_thumbnails.py b/utilities/download_thumbnails.py index 89ca303..af41746 100644 --- a/utilities/download_thumbnails.py +++ b/utilities/download_thumbnails.py @@ -1,6 +1,3 @@ -import logging -logging.basicConfig(level=logging.WARNING) - import bot3 as bot import os import traceback diff --git a/ycdl/ycdldb.py b/ycdl/ycdldb.py index 457c738..4e3f89a 100644 --- a/ycdl/ycdldb.py +++ b/ycdl/ycdldb.py @@ -15,12 +15,6 @@ from voussoirkit import pathclass from voussoirkit import sqlhelpers -logging.basicConfig() -logging.getLogger('googleapiclient.discovery').setLevel(logging.WARNING) -logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING) -logging.getLogger('requests.packages.urllib3.util.retry').setLevel(logging.WARNING) - - class YCDLDBCacheManagerMixin: _THING_CLASSES = { 'channel': @@ -417,7 +411,6 @@ class YCDLDB( # LOGGING self.log = logging.getLogger(__name__) - self.log.setLevel(logging.DEBUG) # DATABASE self.database_filepath = self.data_directory.with_child(constants.DEFAULT_DBNAME) diff --git a/ycdl/ytapi.py b/ycdl/ytapi.py index 18d08e5..af31159 100644 --- a/ycdl/ytapi.py +++ b/ycdl/ytapi.py @@ -4,12 +4,6 @@ import logging from . import helpers -logging.basicConfig(level=logging.DEBUG) -log = logging.getLogger(__name__) -logging.getLogger('googleapiclient.discovery').setLevel(logging.WARNING) -logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING) -logging.getLogger('requests.packages.urllib3.util.retry').setLevel(logging.WARNING) - def int_none(x): if x is None: @@ -52,7 +46,6 @@ class Video: def __str__(self): return 'Video:%s' % self.id - class Youtube: def __init__(self, key): youtube = apiclient.discovery.build( @@ -60,6 +53,7 @@ class Youtube: serviceName='youtube', version='v3', ) + self.log = logging.getLogger(__name__) self.youtube = youtube def get_playlist_videos(self, playlist_id): @@ -76,7 +70,7 @@ class Youtube: videos = self.get_video(video_ids) videos.sort(key=lambda x: x.published, reverse=True) - log.debug('Got %d more videos.', len(videos)) + self.log.debug('Got %d more videos.', len(videos)) for video in videos: yield video