Repository: iterative/dvc

Issue:
Warning messages in stdout
```
$ dvc -V
0.60.1+39104a
$ dvc pipeline show > OUT
$ cat OUT
WARNING: assuming default target 'Dvcfile'.
data/data.xml.dvc
prepare.dvc
featurize.dvc
train.dvc
evaluate.dvc
Dvcfile
```

The warning message `WARNING: assuming default target 'Dvcfile'.` is supposed to be in stderr, not stdout. This seems to work just fine for error messages, but not for warnings.

Many other commands might have the same warning issue. It would be great if this can be fixed holistically.

Discussion:

Patch:
diff --git a/dvc/logger.py b/dvc/logger.py
index 8e11f0e62..9fab58634 100644
--- a/dvc/logger.py
+++ b/dvc/logger.py
@@ -19,7 +19,7 @@ class LoggingException(Exception):
 
 class ExcludeErrorsFilter(logging.Filter):
     def filter(self, record):
-        return record.levelno < logging.ERROR
+        return record.levelno < logging.WARNING
 
 
 class ColorFormatter(logging.Formatter):
@@ -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",
                 },


Test patch:
diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py
index 57c876b3d..3560018a9 100644
--- a/tests/unit/test_logger.py
+++ b/tests/unit/test_logger.py
@@ -179,3 +179,10 @@ class TestColorFormatter:
                     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