mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
appveyor: added logging level configuration
This commit is contained in:
parent
5c72203180
commit
1178501aaf
|
@ -26,13 +26,14 @@ STEP_PREFIX = 'step_'
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s'
|
level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global opt
|
global opt
|
||||||
opt = parse_cmdline()
|
opt = parse_cmdline()
|
||||||
|
logger.setLevel(opt.loglevel)
|
||||||
|
|
||||||
setup_env()
|
setup_env()
|
||||||
cmd = globals()[STEP_PREFIX + opt.step]
|
cmd = globals()[STEP_PREFIX + opt.step]
|
||||||
|
@ -487,14 +488,14 @@ def ensure_dir(dir):
|
||||||
def run_command(cmdline, **kwargs):
|
def run_command(cmdline, **kwargs):
|
||||||
if not isinstance(cmdline, str):
|
if not isinstance(cmdline, str):
|
||||||
cmdline = list(map(str, cmdline))
|
cmdline = list(map(str, cmdline))
|
||||||
logger.debug("calling command: %s", cmdline)
|
logger.info("running command: %s", cmdline)
|
||||||
sp.check_call(cmdline, **kwargs)
|
sp.check_call(cmdline, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def out_command(cmdline, **kwargs):
|
def out_command(cmdline, **kwargs):
|
||||||
if not isinstance(cmdline, str):
|
if not isinstance(cmdline, str):
|
||||||
cmdline = list(map(str, cmdline))
|
cmdline = list(map(str, cmdline))
|
||||||
logger.debug("calling command: %s", cmdline)
|
logger.info("running command: %s", cmdline)
|
||||||
data = sp.check_output(cmdline, **kwargs)
|
data = sp.check_output(cmdline, **kwargs)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -545,6 +546,26 @@ def parse_cmdline():
|
||||||
help="the target python architecture. Default from PYTHON_ARCH env var",
|
help="the target python architecture. Default from PYTHON_ARCH env var",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
g = parser.add_mutually_exclusive_group()
|
||||||
|
g.add_argument(
|
||||||
|
'-q',
|
||||||
|
'--quiet',
|
||||||
|
help="Talk less",
|
||||||
|
dest='loglevel',
|
||||||
|
action='store_const',
|
||||||
|
const=logging.WARN,
|
||||||
|
default=logging.INFO,
|
||||||
|
)
|
||||||
|
g.add_argument(
|
||||||
|
'-v',
|
||||||
|
'--verbose',
|
||||||
|
help="Talk more",
|
||||||
|
dest='loglevel',
|
||||||
|
action='store_const',
|
||||||
|
const=logging.DEBUG,
|
||||||
|
default=logging.INFO,
|
||||||
|
)
|
||||||
|
|
||||||
steps = [
|
steps = [
|
||||||
n[len(STEP_PREFIX) :]
|
n[len(STEP_PREFIX) :]
|
||||||
for n in globals()
|
for n in globals()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user