2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

chore: update APIs, remove duplicate logs

This commit is contained in:
Gavin D'souza 2020-05-21 13:14:16 +05:30
parent 4480ea21ac
commit 7dc5fdb7b3
2 changed files with 8 additions and 11 deletions

View File

@ -59,8 +59,10 @@ def cli():
try:
bench_command()
except BaseException as e:
logger.warn("{0} executed with exit code {1}".format(command, getattr(e, "code", None)))
sys.exit(1)
return_code = getattr(e, "code", 0)
if return_code:
logger.warning("{0} executed with exit code {1}".format(command, return_code))
sys.exit(return_code)
def check_uid():

View File

@ -302,7 +302,7 @@ def exec_cmd(cmd, cwd='.'):
cmd = shlex.split(cmd)
return_code = subprocess.call(cmd, cwd=cwd, universal_newlines=True)
if return_code:
logger.warn("{0} executed with exit code {1}".format(cmd_log, return_code))
logger.warning("{0} executed with exit code {1}".format(cmd_log, return_code))
def which(executable, raise_err = False):
@ -449,13 +449,8 @@ def setup_logging(bench_path='.'):
hdlr = logging.FileHandler(log_file)
hdlr.setFormatter(formatter)
log_hndlr = logging.StreamHandler(sys.stdout)
log_hndlr.setFormatter(logging.Formatter('%(message)s'))
log_hndlr.addFilter(log_filter(LOG_LEVEL))
logger.addHandler(hdlr)
logger.addHandler(log_hndlr)
logger.setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)
return logger
@ -985,7 +980,7 @@ def migrate_env(python, backup=False):
logger.log('Clearing Redis DataBase...')
exec_cmd('{redis} FLUSHDB'.format(redis = redis))
except:
logger.warn('Please ensure Redis Connections are running or Daemonized.')
logger.warning('Please ensure Redis Connections are running or Daemonized.')
# Backup venv: restore using `virtualenv --relocatable` if needed
if backup:
@ -1015,7 +1010,7 @@ def migrate_env(python, backup=False):
logger.log('Migration Successful to {}'.format(python))
except:
if venv_creation or packages_setup:
logger.warn('Migration Error')
logger.warning('Migration Error')
def is_dist_editable(dist):