Readd accidentally dropped StreamHandler

This commit is contained in:
Matthias 2020-08-14 19:50:56 +02:00
parent 9ad8e74247
commit 122c0e8ddc
2 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,9 @@
import logging import logging
import queue import queue
import sys
from logging import Formatter from logging import Formatter
from logging.handlers import RotatingFileHandler, SysLogHandler, BufferingHandler from logging.handlers import (BufferingHandler, RotatingFileHandler,
SysLogHandler)
from typing import Any, Dict from typing import Any, Dict
from freqtrade.exceptions import OperationalException from freqtrade.exceptions import OperationalException
@ -58,6 +60,9 @@ def setup_logging(config: Dict[str, Any]) -> None:
logging.root.addHandler(bufferHandler) logging.root.addHandler(bufferHandler)
logfile = config.get('logfile') logfile = config.get('logfile')
logging.root.addHandler(logging.StreamHandler(sys.stderr))
if logfile: if logfile:
s = logfile.split(':') s = logfile.split(':')
if s[0] == 'syslog': if s[0] == 'syslog':

View File

@ -675,7 +675,7 @@ def test_set_loggers_syslog(mocker):
} }
setup_logging(config) setup_logging(config)
assert len(logger.handlers) == 2 assert len(logger.handlers) == 3
assert [x for x in logger.handlers if type(x) == logging.handlers.SysLogHandler] assert [x for x in logger.handlers if type(x) == logging.handlers.SysLogHandler]
assert [x for x in logger.handlers if type(x) == logging.StreamHandler] assert [x for x in logger.handlers if type(x) == logging.StreamHandler]
# reset handlers to not break pytest # reset handlers to not break pytest