formatter = logging.Formatter("%(levelname)s: %(message)s") console = logging.StreamHandler() console.setFormatter(formatter) logging.root.addHandler(console) if options.debug: logging.root.setLevel(logging.DEBUG) else: logging.root.setLevel(logging.INFO) log = logging.getLogger("bongo.admintool") if command is None: parser.print_help() parser.exit() if os.getegid() != 0: log.error("%s must be run as root" % os.path.basename(sys.argv[0])) sys.exit(1) Privs.DropPrivs() if options.authpass is None: try: options.authpass = getpass.getpass(_("Enter password for %s: ") % options.authuser) except KeyboardInterrupt: print sys.exit(1) log.debug("running command: %s", str(command))