Skip to content

Commit

Permalink
logger: send warning messages to stderr (iterative#2612)
Browse files Browse the repository at this point in the history
* logger: send warning messages to stderr

Fix iterative#2561

* logger: filter warnings for stdout
  • Loading branch information
Mr. Outis authored and efiop committed Oct 16, 2019
1 parent 0bfb3c0 commit 13a7e0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dvc/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, record):

class ExcludeErrorsFilter(logging.Filter):
def filter(self, record):
return record.levelno < logging.ERROR
return record.levelno < logging.WARNING


class ColorFormatter(logging.Formatter):
Expand Down Expand Up @@ -182,7 +182,7 @@ def setup(level=logging.INFO):
},
"console_errors": {
"class": "dvc.logger.LoggerHandler",
"level": "ERROR",
"level": "WARNING",
"formatter": "color",
"stream": "ext://sys.stderr",
},
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,10 @@ def test_progress_awareness(self, mocker, capsys, caplog):
logger.info("some info")
captured = capsys.readouterr()
assert captured.out == ""


def test_handlers():
stdout, stderr = logger.handlers

assert stdout.level == logging.DEBUG
assert stderr.level == logging.WARNING

0 comments on commit 13a7e0f

Please sign in to comment.