Add logging handler.

This commit is contained in:
Anthony Sottile 2014-04-05 21:50:20 -07:00
parent 4ed9120ae9
commit a3720c0645
5 changed files with 60 additions and 14 deletions

View file

@ -2,16 +2,20 @@
from __future__ import print_function
import argparse
import logging
import subprocess
import sys
from pre_commit import color
from pre_commit import commands
from pre_commit import git
from pre_commit.logging_handler import LoggingHandler
from pre_commit.runner import Runner
from pre_commit.util import entry
logger = logging.getLogger('pre_commit')
COLS = int(subprocess.Popen(['tput', 'cols'], stdout=subprocess.PIPE).communicate()[0])
PASS_FAIL_LENGTH = 6
@ -81,6 +85,10 @@ def run_single_hook(runner, hook_id, args):
def _run(runner, args):
# Set up our logging handler
logger.addHandler(LoggingHandler(args.color))
logger.setLevel(logging.INFO)
if args.hook:
return run_single_hook(runner, args.hook, args)
else: