Allow different loglevels
This commit is contained in:
@@ -12,10 +12,22 @@ from jsonschema import Draft4Validator, validate
|
||||
from jsonschema.exceptions import ValidationError, best_match
|
||||
|
||||
from freqtrade import OperationalException, constants
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def set_loggers(log_level: int = 0) -> None:
|
||||
"""
|
||||
Set the logger level for Third party libs
|
||||
:return: None
|
||||
"""
|
||||
|
||||
logging.getLogger('requests').setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)
|
||||
logging.getLogger("urllib3").setLevel(logging.INFO if log_level <= 1 else logging.DEBUG)
|
||||
logging.getLogger('ccxt.base.exchange').setLevel(
|
||||
logging.INFO if log_level <= 2 else logging.DEBUG)
|
||||
logging.getLogger('telegram').setLevel(logging.INFO)
|
||||
|
||||
|
||||
class Configuration(object):
|
||||
"""
|
||||
Class to read and init the bot configuration
|
||||
@@ -81,9 +93,10 @@ class Configuration(object):
|
||||
if 'loglevel' in self.args and self.args.loglevel:
|
||||
config.update({'loglevel': self.args.loglevel})
|
||||
logging.basicConfig(
|
||||
level=config['loglevel'],
|
||||
level=logging.DEBUG,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
||||
)
|
||||
set_loggers(config['loglevel'])
|
||||
logger.info('Log level set to %s', logging.getLevelName(config['loglevel']))
|
||||
|
||||
# Add dynamic_whitelist if found
|
||||
|
||||
Reference in New Issue
Block a user