Centralize logging initialization

This commit is contained in:
Anthony Sottile
2016-11-26 14:18:13 -08:00
parent 323507c9e3
commit a7169905dc
18 changed files with 26 additions and 43 deletions

View File

@@ -6,6 +6,8 @@ from pre_commit import color
from pre_commit import output
logger = logging.getLogger('pre_commit')
LOG_LEVEL_COLORS = {
'DEBUG': '',
'INFO': '',
@@ -30,3 +32,8 @@ class LoggingHandler(logging.Handler):
record.getMessage(),
)
)
def add_logging_handler(*args, **kwargs):
logger.addHandler(LoggingHandler(*args, **kwargs))
logger.setLevel(logging.INFO)