mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Add logging handler.
This commit is contained in:
parent
4ed9120ae9
commit
a3720c0645
5 changed files with 60 additions and 14 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue