Exemplo n.º 1
0
  def __init__(self):
    conf = Config.load_log()

    # log format setting
    FORMAT = conf['format']

    # log level setting
    if conf['level'] == "debug":
      LEVEL = logging.DEBUG
    elif conf['level'] == "info":
      LEVEL = logging.INFO
    elif conf['level'] == "warn":
      LEVEL = logging.WARNING
    elif conf['level'] == "error":
      LEVEL = logging.ERROR
    elif conf['level'] == "crit":
      LEVEL = logging.CRITICAL
    else:
      raise StError("incorrect log level setting")

    if not conf['filename'] == "stdout":
      FILENAME = conf['filename']
      logging.basicConfig(
        level = LEVEL, format=FORMAT, filename=FILENAME
      )
    else:
      logging.basicConfig(
        level = LEVEL, format=FORMAT
      )
Exemplo n.º 2
0
Arquivo: api.py Projeto: risuoku/stapi
  def __init__(self):
    auth_info_list = Config.load_auth_info()
    self.logger = Logger()

    # mutable -----------
    self.api_list = map(self._get_authorized_api, auth_info_list)
    self.index = 0
    self.count = 0