def main():
debug = os.environ.get('DEBUG', '').lower() in ('1', 'y')
verbose = os.environ.get('VERBOSE', '').lower() in ('1', 'y')
config = Configuration()
config['debug'] = debug
config['verbose'] = debug or verbose
config['color'] = sys.stderr.isatty()
dictConfig(config.logging_dict())
logger.debug("Debug mode enabled.")
try:
exit(wrapped_main(config))
except pdb.bdb.BdbQuit:
logger.info("Graceful exit from debugger.")
except UserError as e:
logger.critical("%s", e)
exit(e.exit_code)
except Exception:
logger.exception('Unhandled error:')
if debug and sys.stdout.isatty():
logger.debug("Dropping in debugger.")
pdb.post_mortem(sys.exc_info()[2])
else:
logger.error(
"Please file an issue at "
"https://github.com/dalibo/ldap2pg/issues with full log.",
)
exit(os.EX_SOFTWARE)
评论列表
文章目录