Move logging basicconfig effort to frontmost application layer.
This commit is contained in:
		
							parent
							
								
									ee89582a1b
								
							
						
					
					
						commit
						3f3eda58b1
					
				
					 6 changed files with 11 additions and 22 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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() | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -1,6 +1,3 @@ | |||
| import logging | ||||
| logging.basicConfig(level=logging.WARNING) | ||||
| 
 | ||||
| import bot3 as bot | ||||
| import os | ||||
| import traceback | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue