当前位置: 首页>>代码示例>>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;未经允许,请勿转载。