Add log_level param to constructor, like Etq.
This commit is contained in:
parent
13e6f7e1f0
commit
11414b4088
2 changed files with 3 additions and 2 deletions
|
@ -11,7 +11,6 @@ handler = logging.StreamHandler()
|
||||||
log_format = '{levelname}:ycdl.{module}.{funcName}: {message}'
|
log_format = '{levelname}:ycdl.{module}.{funcName}: {message}'
|
||||||
handler.setFormatter(logging.Formatter(log_format, style='{'))
|
handler.setFormatter(logging.Formatter(log_format, style='{'))
|
||||||
logging.getLogger().addHandler(handler)
|
logging.getLogger().addHandler(handler)
|
||||||
logging.getLogger('ycdl').setLevel(logging.DEBUG)
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import gevent.pywsgi
|
import gevent.pywsgi
|
||||||
|
@ -58,7 +57,7 @@ def ycdl_flask_launch(
|
||||||
site.localhost_only = True
|
site.localhost_only = True
|
||||||
|
|
||||||
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
|
youtube_core = ycdl.ytapi.Youtube(bot.get_youtube_key())
|
||||||
backend.common.init_ycdldb(youtube_core, create=create)
|
backend.common.init_ycdldb(youtube_core, create=create, log_level=logging.DEBUG)
|
||||||
|
|
||||||
if refresh_rate is not None:
|
if refresh_rate is not None:
|
||||||
backend.common.start_refresher_thread(refresh_rate)
|
backend.common.start_refresher_thread(refresh_rate)
|
||||||
|
|
|
@ -460,6 +460,7 @@ class YCDLDB(
|
||||||
youtube,
|
youtube,
|
||||||
create=True,
|
create=True,
|
||||||
data_directory=None,
|
data_directory=None,
|
||||||
|
log_level=vlogging.NOTSET,
|
||||||
skip_version_check=False,
|
skip_version_check=False,
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -476,6 +477,7 @@ class YCDLDB(
|
||||||
|
|
||||||
# LOGGING
|
# LOGGING
|
||||||
self.log = vlogging.getLogger('ycdl:%s' % self.data_directory.absolute_path)
|
self.log = vlogging.getLogger('ycdl:%s' % self.data_directory.absolute_path)
|
||||||
|
self.log.setLevel(log_level)
|
||||||
|
|
||||||
# DATABASE
|
# DATABASE
|
||||||
self.database_filepath = self.data_directory.with_child(constants.DEFAULT_DBNAME)
|
self.database_filepath = self.data_directory.with_child(constants.DEFAULT_DBNAME)
|
||||||
|
|
Loading…
Reference in a new issue