dont disable existing loggers when dvc is set up (#3345)

* dont disable existing loggers when dvc is set up

* corrected code style

* dont disable existing loggers, fixes

Co-authored-by: Guro Bokum <[email protected]>
This commit is contained in:
ttekampe
2020-02-27 07:02:06 +02:00
committed by GitHub
co-authored by Guro Bokum
parent d8778e7ca9
commit de453ab06d
3 changed files with 12 additions and 20 deletions
+8 -16
View File
@@ -141,6 +141,13 @@ def _stack_trace(exc_info):
)
def disable_other_loggers():
root = logging.root
for (logger_name, logger) in root.manager.loggerDict.items():
if logger_name != "dvc" and not logger_name.startswith("dvc."):
logger.disabled = True
def setup(level=logging.INFO):
colorama.init()
@@ -183,22 +190,7 @@ def setup(level=logging.INFO):
"console_errors",
],
},
"paramiko": {
"level": logging.CRITICAL,
"handlers": [
"console_info",
"console_debug",
"console_errors",
],
},
"flufl.lock": {
"level": logging.CRITICAL,
"handlers": [
"console_info",
"console_debug",
"console_errors",
],
},
},
"disable_existing_loggers": False,
}
)
+2 -1
View File
@@ -9,7 +9,7 @@ from dvc.config import ConfigError
from dvc.exceptions import DvcParserError
from dvc.exceptions import NotDvcRepoError
from dvc.external_repo import clean_repos
from dvc.logger import FOOTER
from dvc.logger import disable_other_loggers, FOOTER
from dvc.utils import format_link
from dvc.remote.pool import close_pools
@@ -34,6 +34,7 @@ def main(argv=None):
"""
args = None
cmd = None
disable_other_loggers()
outerLogLevel = logger.level
try:
+2 -3
View File
@@ -45,12 +45,12 @@ from global repo template to creating everything inplace, which:
import os
import pathlib
import logging
from contextlib import contextmanager
import pytest
from funcy import lmap, retry
from dvc.logger import disable_other_loggers
from dvc.utils.fs import makedirs
from dvc.compat import fspath, fspath_py35
@@ -67,8 +67,7 @@ __all__ = [
# see https://github.com/iterative/dvc/issues/3167
git_logger = logging.getLogger("git")
git_logger.setLevel(logging.CRITICAL)
disable_other_loggers()
class TmpDir(pathlib.Path):