feat: logging repo_info

This commit is contained in:
muxueqz 2019-09-16 19:42:06 +08:00
parent 9813e81124
commit 9e91943a07

View file

@ -3,6 +3,8 @@ import sys
import re import re
import os import os
import subprocess import subprocess
import logging
try: try:
import ConfigParser import ConfigParser
except: except:
@ -16,6 +18,10 @@ config.read(config_path)
repo_info_regex = r'(\S+)=(.*)' repo_info_regex = r'(\S+)=(.*)'
password_store_path = os.path.join(home_path, '.password-store') password_store_path = os.path.join(home_path, '.password-store')
FORMAT = '%(asctime)-15s %(message)s'
logging.basicConfig(format=FORMAT, filename='/tmp/git-credential-pass.log')
logger = logging.getLogger('base')
operation = sys.argv[1] operation = sys.argv[1]
if operation != "get": if operation != "get":
sys.exit(1) sys.exit(1)
@ -23,6 +29,7 @@ if operation != "get":
repo_info_string = sys.stdin.read() repo_info_string = sys.stdin.read()
repo_info = dict(re.findall(repo_info_regex, repo_info_string)) repo_info = dict(re.findall(repo_info_regex, repo_info_string))
logger.warning('repo_info: %s', repo_info)
if 'host' not in repo_info: if 'host' not in repo_info:
sys.stderr.write("Host not set\n") sys.stderr.write("Host not set\n")