mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Initialize streamhandler early to have it apply to all logs
This commit is contained in:
parent
cdfcdb86c9
commit
c4f78203ab
|
@ -48,6 +48,7 @@ def setup_logging_pre() -> None:
|
|||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format=LOGFORMAT,
|
||||
handlers=[logging.StreamHandler(sys.stderr)]
|
||||
)
|
||||
|
||||
|
||||
|
@ -61,8 +62,6 @@ def setup_logging(config: Dict[str, Any]) -> None:
|
|||
|
||||
logfile = config.get('logfile')
|
||||
|
||||
logging.root.addHandler(logging.StreamHandler(sys.stderr))
|
||||
|
||||
if logfile:
|
||||
s = logfile.split(':')
|
||||
if s[0] == 'syslog':
|
||||
|
|
|
@ -21,7 +21,7 @@ from freqtrade.configuration.deprecated_settings import (
|
|||
from freqtrade.configuration.load_config import load_config_file, log_config_error_range
|
||||
from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.loggers import _set_loggers, setup_logging
|
||||
from freqtrade.loggers import _set_loggers, setup_logging, setup_logging_pre
|
||||
from freqtrade.state import RunMode
|
||||
from tests.conftest import (log_has, log_has_re,
|
||||
patched_configuration_load_config_file)
|
||||
|
@ -674,6 +674,7 @@ def test_set_loggers_syslog(mocker):
|
|||
'logfile': 'syslog:/dev/log',
|
||||
}
|
||||
|
||||
setup_logging_pre()
|
||||
setup_logging(config)
|
||||
assert len(logger.handlers) == 3
|
||||
assert [x for x in logger.handlers if type(x) == logging.handlers.SysLogHandler]
|
||||
|
|
Loading…
Reference in New Issue
Block a user