def start_cli(self, args=None, histfile=config.HISTORY): self.args = args or None self.histfile = histfile #log.to_file(level=5, filename='logs/debug_log.txt') self.log, self.log_hdl_term = log.to_term(level=5) self.log = logging.getLogger(self.name) opt = optparse.OptionParser(usage='%prog [options] [<arg>] [...]') opt.add_option('-v', '--verbosity', dest='verb', metavar="LEVEL", default=4, help='From 1 (quiet) to 5 (debug). Default: 4') self.opts, self.args = opt.parse_args() self.log_level = int(self.opts.verb) log.set_level(self.log_level) self.start(args=self.args)
def log_setup_cli(self): log.init() self.log, self.log_hdl_term = log.to_term(level=5) self.log = logging.getLogger('D2 LOG')