當前位置: 首頁>>代碼示例>>Python>>正文


Python logger.get方法代碼示例

本文整理匯總了Python中logger.get方法的典型用法代碼示例。如果您正苦於以下問題:Python logger.get方法的具體用法?Python logger.get怎麽用?Python logger.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在logger的用法示例。


在下文中一共展示了logger.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, filename=None, default_verbose=0):
    """
    Constructs a logger with optional log file output.

    Args:
        filename: optional log file output. If None, nothing will be 
        written to file
    """
    now = datetime.datetime.now()
    self.verbose_thresh = int(os.environ.get("VERBOSE", 0))
    self.default_verbose = default_verbose
    if filename is not None:
      self.filename = filename
      dirname = os.path.dirname(self.filename)
      if not os.path.exists(dirname):
        os.makedirs(dirname)
      open(self.filename, "w").close()
      self.info("Log written to {}".format(os.path.abspath(self.filename)))
    else:
      self.filename = None

    pass 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:24,代碼來源:logger.py

示例2: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, filename=None, default_verbose=0):
    """
    Constructs a logger with optional log file output.

    Args:
        filename: optional log file output. If None, nothing will be
        written to file
    """
    now = datetime.datetime.now()
    self.verbose_thresh = int(os.environ.get("VERBOSE", 0))
    self.default_verbose = default_verbose
    if filename is not None:
      self.filename = filename
      dirname = os.path.dirname(self.filename)
      if not os.path.exists(dirname):
        os.makedirs(dirname)
      open(self.filename, "w").close()
      self.info("Log written to {}".format(os.path.abspath(self.filename)))
    else:
      self.filename = None

    pass 
開發者ID:renmengye,項目名稱:inc-few-shot-attractor-public,代碼行數:24,代碼來源:logger.py

示例3: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, filename=None, default_verbose=0):
    """
    Constructs a logger with optional log file output.

    Args:
        filename: optional log file output. If None, nothing will be 
        written to file
    """
    now = datetime.datetime.now()
    self.verbose_thresh = int(os.environ.get('VERBOSE', 0))
    self.default_verbose = default_verbose
    if filename is not None:
      self.filename = filename
      dirname = os.path.dirname(self.filename)
      if not os.path.exists(dirname):
        os.makedirs(dirname)
      open(self.filename, 'w').close()
      self.info('Log written to {}'.format(os.path.abspath(self.filename)))
    else:
      self.filename = None

    pass 
開發者ID:renmengye,項目名稱:tensorflow-forward-ad,代碼行數:24,代碼來源:logger.py

示例4: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, filename=None):
        """
        Constructs a logger with optional log file output.

        Args:
            filename: optional log file output. If None, nothing will be 
            written to file
        """
        now = datetime.datetime.now()
        self.verbose_thresh = os.environ.get('VERBOSE', 0)
        if filename is not None:
            self.filename = \
                '{}-{:04d}{:02d}{:02d}-{:02d}{:02d}{:02d}.log'.format(
                    filename,
                    now.year, now.month, now.day,
                    now.hour, now.minute, now.second)
            dirname = os.path.dirname(self.filename)
            if not os.path.exists(dirname):
                os.makedirs(dirname)
            open(self.filename, 'w').close()
            self.info('Log written to {}'.format(
                os.path.abspath(self.filename)))
        else:
            self.filename = None
        pass 
開發者ID:renmengye,項目名稱:imageqa-qgen,代碼行數:27,代碼來源:logger.py

示例5: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, filename=None, default_verbose=0):
        """
        Constructs a logger with optional log file output.

        Args:
            filename: optional log file output. If None, nothing will be
            written to file
        """
        now = datetime.datetime.now()
        self.verbose_thresh = int(os.environ.get('VERBOSE', 0))
        self.default_verbose = default_verbose
        if filename is not None:
            self.filename = filename
            dirname = os.path.dirname(self.filename)
            if not os.path.exists(dirname):
                os.makedirs(dirname)
            open(self.filename, 'w').close()
            self.info('Log written to {}'.format(os.path.abspath(self.filename)))
        else:
            self.filename = None

        pass 
開發者ID:renmengye,項目名稱:meta-optim-public,代碼行數:24,代碼來源:logger.py

示例6: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, folder, model_opt=None, data_opt=None):
    if not os.path.exists(folder):
      os.makedirs(folder)
    self.folder = folder
    self.log = logger.get()
    self.tf_saver = None
    if model_opt is not None:
      self.save_opt(os.path.join(folder, kModelOptFilename), model_opt)
    if data_opt is not None:
      self.save_opt(os.path.join(folder, kDatasetOptFilename), data_opt) 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:12,代碼來源:saver.py

示例7: get

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def get(fname=None):
  """
  Returns a logger instance, with optional log file output.
  """
  global log
  if log is not None and fname is None:
    return log

    # fname = os.environ.get("LOGTO", None)
    # if fname is None:
    #     fname = default_fname
  else:
    log = Logger(fname)

    return log 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:17,代碼來源:logger.py

示例8: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, q, batch_iter):
    super(BatchProducer, self).__init__()
    threading.Thread.__init__(self)
    self.q = q
    self.batch_iter = batch_iter
    self.log = logger.get()
    self._stop = threading.Event()
    self.daemon = True 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:10,代碼來源:concurrent_batch_iter.py

示例9: run

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def run(self):
    while not self.stopped():
      try:
        self.q.get(False)
        self.q.task_done()
      except queue.Empty:
        pass 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:9,代碼來源:concurrent_batch_iter.py

示例10: next

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def next(self):
    if self._stopped:
      raise StopIteration
    self.scan(do_print=(self.counter % self.log_queue == 0))
    if self.counter % self.log_queue == 0:
      self.counter = 0
    batch = self.q.get()
    self.q.task_done()
    self.counter += 1
    while batch is None:
      self.info("Got an empty batch. Ending iteration.")
      self.relaunch = False
      try:
        batch = self.q.get(False)
        self.q.task_done()
        qempty = False
      except queue.Empty:
        qempty = True
        pass

      if qempty:
        self.info("Queue empty. Scanning for alive thread.")
        # Scan for alive thread.
        found_alive = False
        for ff in self.fetchers:
          if ff.is_alive():
            found_alive = True
            break

        self.info("No alive thread found. Joining.")
        # If no alive thread, join all.
        if not found_alive:
          for ff in self.fetchers:
            ff.join()
          self._stopped = True
          raise StopIteration
      else:
        self.info("Got another batch from the queue.")
    return batch 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:41,代碼來源:concurrent_batch_iter.py

示例11: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, folder, name):
    if not os.path.exists(folder):
      os.makedirs(folder)
    self.folder = folder
    self.log = logger.get()
    self.fname = os.path.join(folder, name + '.yaml') 
開發者ID:renmengye,項目名稱:rec-attend-public,代碼行數:8,代碼來源:option_saver.py

示例12: get

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def get(fname=None):
  """
  Returns a logger instance, with optional log file output.
  """
  global log
  if log is not None and fname is None:
    return log

    # fname = os.environ.get('LOGTO', None)
    # if fname is None:
    #     fname = default_fname
  else:
    log = Logger(fname)

    return log 
開發者ID:renmengye,項目名稱:tensorflow-forward-ad,代碼行數:17,代碼來源:logger.py

示例13: get

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def get(default_fname=None):
    """
    Returns a logger instance, with optional log file output.
    """
    global log
    if log is not None:
        return log
    fname = os.environ.get('LOGTO', None)
    if fname is None:
        fname = default_fname
    log = Logger(fname)
    return log 
開發者ID:renmengye,項目名稱:imageqa-qgen,代碼行數:14,代碼來源:logger.py

示例14: __init__

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def __init__(self, config):
        self._mqtt_callbacks = []
        self._config_commands = []
        self._update_commands = []
        self._scheduler = BackgroundScheduler(timezone=utc)
        self._daemons = []
        self._config = config
        self._command_timeout = config.get("command_timeout", DEFAULT_COMMAND_TIMEOUT) 
開發者ID:zewelor,項目名稱:bt-mqtt-gateway,代碼行數:10,代碼來源:workers_manager.py

示例15: _publish_config

# 需要導入模塊: import logger [as 別名]
# 或者: from logger import get [as 別名]
def _publish_config(self, mqtt):
        for command in self._config_commands:
            messages = command.execute()
            for msg in messages:
                msg.topic = "{}/{}".format(
                    self._config["sensor_config"].get("topic", "homeassistant"),
                    msg.topic,
                )
                msg.retain = self._config["sensor_config"].get("retain", True)
            mqtt.publish(messages) 
開發者ID:zewelor,項目名稱:bt-mqtt-gateway,代碼行數:12,代碼來源:workers_manager.py


注:本文中的logger.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。