本文整理汇总了Python中log.logger.debug方法的典型用法代码示例。如果您正苦于以下问题:Python logger.debug方法的具体用法?Python logger.debug怎么用?Python logger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log.logger
的用法示例。
在下文中一共展示了logger.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_analyze
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def do_analyze(self):
ckpt_hash = f"{self.bot.history_hash()}_{self.bot.time_per_move}_sec"
ckpt_fn = os.path.join(self.base_dir, ckpt_hash)
if os.path.exists(ckpt_fn):
logger.debug("Loading checkpoint file: %s", ckpt_fn)
with open(ckpt_fn, 'rb') as ckpt_file:
stats, move_list = pickle.load(ckpt_file)
else:
self.bot.clear_board()
self.bot.go_to_position()
stats, move_list = self.bot.analyze()
with open(ckpt_fn, 'wb') as ckpt_file:
pickle.dump((stats, move_list), ckpt_file)
return stats, move_list
示例2: analyze
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def analyze(self):
"""Analyze current position with given seconds per search."""
stdout, stderr = self.genmove()
# Drain and parse Leela stdout & stderr
stats, move_list = self.parse_analysis(stdout, stderr)
if stats.get('winrate') and move_list:
best_move = convert_position(self.board_size, move_list[0]['pos'])
winrate = (stats['winrate'] * 100)
visits = stats['visits']
pv = " ".join([convert_position(self.board_size, m) for m in move_list[0]['pv']])
logger.debug(f"Suggested: %s (winrate %.2f%%, %d visits). Perfect sequence: %s",
best_move, winrate, visits, pv)
else:
chosen_move = convert_position(self.board_size, stats['chosen'])
logger.debug(f"Chosen move: %s", chosen_move)
return stats, move_list
示例3: overlap_layer_to_image
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def overlap_layer_to_image(appname, cfg_tag, cfg_layer_count, sjwt, target_repo, target_tag, tjwt):
logger.info("overlap %s:%s in %s to repo %s:%s in %s" % (
appname, cfg_tag, PRIVATE_REGISTRY, target_repo, target_tag, PRIVATE_REGISTRY))
cmd = "%s -srcReg=%s -srcRepo=%s -srcTag=%s -srcLayerCount=%s -srcJWT=%s \
-targetReg=%s -targetRepo=%s -targetTag=%s -targetJWT=%s -newTag=%s" % (
RFP_BIN,
PRIVATE_REGISTRY,
appname,
cfg_tag,
cfg_layer_count,
sjwt,
PRIVATE_REGISTRY,
target_repo,
target_tag,
tjwt,
"%s-%s" % (target_tag, cfg_tag)
)
logger.debug("overlap command is %s" % cmd)
result_code = subprocess.call(cmd, shell=True)
return result_code == 0
示例4: update_meta
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def update_meta(self, meta_version, meta=None, force=False,
update_lain_config=True, update_spec=True):
if meta is not None:
logger.debug("meta of app `%s` was specified to `%s`" %
(self.appname, meta))
self.meta = meta
self.save()
result = "meta specified"
else:
logger.debug("try to update meta of app `%s` to meta version `%s`" % (
self.appname, meta_version))
result = self.base_update_meta(meta_version, force)
if update_lain_config:
self.lain_config = self._get_lain_config()
if update_spec:
self.app_spec = render_app_spec(self.lain_config)
logger.debug("finish updating meta of app `%s`" % self.appname)
return result
示例5: _generate_jwt
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def _generate_jwt():
try:
now = int(time.time())
claims["iat"] = now
claims["nbf"] = now - 1
claims["exp"] = now + TOKEN_EXPIRE_SECOND
claims["jti"] = str(random.uniform(0, RANDOM_MAX_VALUE))
dir_path = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(dir_path, PRV_FILE), 'r') as rsa_priv_file:
key = rsa_priv_file.read()
encoded = jwt.encode(claims, key, algorithm=HEAD_ALG, headers=header)
logger.debug(encoded)
return encoded
except Exception, e:
logger.error("Generate JWT for registry wrong : %s" % str(e))
raise Exception("Generate JWT for registry wrong : %s" % str(e))
示例6: __set__
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def __set__(self, instance, value):
logger.debug("setting %s.descriptor to %s", instance, value)
instance.__dict__["descriptor"] = value
示例7: __get__
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def __get__(self, instance, value):
if instance is None:
return self
logger.debug("getting %r attribute from %r", self.name, instance)
return instance.__dict__[self.name]
示例8: traced_function_wrong
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def traced_function_wrong(function):
"""An example of a badly defined decorator."""
logger.debug("started execution of %s", function)
start_time = time.time()
@wraps(function)
def wrapped(*args, **kwargs):
result = function(*args, **kwargs)
logger.info(
"function %s took %.2fs", function, time.time() - start_time
)
return result
return wrapped
示例9: search_nested
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def search_nested(array, desired_value):
""""Searching in multiple dimensions with a single loop."""
try:
coord = next(
coord
for (coord, cell) in _iterate_array2d(array)
if cell == desired_value
)
except StopIteration:
raise ValueError("{desired_value} not found")
logger.debug("value %r found at [%i, %i]", desired_value, *coord)
return coord
示例10: close
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def close(self):
logger.debug("closing connection to database %r", self.db)
self.is_closed = True
示例11: extract_table
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def extract_table(sheet, table, name, names, header, body, **kwargs):
# header: (A6, E6)
# body: (A7, E13)
row1, col1 = cell_name_to_pos(header[0])
row2, col2 = cell_name_to_pos(header[1])
column_names = [get_identifier(sheet, table, row1, j) for j in range(col1,col2+1)]
row1, col1 = cell_name_to_pos(body[0])
row2, col2 = cell_name_to_pos(body[1])
row_names = [get_identifier(sheet, table, i, col1) for i in range(row1,row2+1)]
#logger.debug(str((sheet, table, name, names, header, body)))
data = []
for i in range(row1, row2 + 1):
data.append([sheet.cell(i, j).value for j in range(col1 + 1, col2 + 1)])
return {
'meta': {
'table_id': table,
'table_name': name,
'table_names': names,
# other meta data
},
'row_names': row_names,
'column_names': column_names,
'data': data}
示例12: genmove
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def genmove(self):
self.send_command(f'time_left black {self.time_per_move:d} 1')
self.send_command(f'time_left white {self.time_per_move:d} 1')
logger.debug("Board state: %s to play\n%s", self.whose_turn(), self.showboard())
# Generate next move
self.process.stdin.write(f"genmove {self.whose_turn()}\n")
self.process.stdin.flush()
updated = 0
stdout = []
stderr = []
while updated < self.time_per_move * 2:
out, err = self.drain()
stdout.extend(out)
stderr.extend(err)
self.parse_status_update("".join(err))
if out:
break
updated += 1
sleep(1)
# Confirm generated move with new line
self.process.stdin.write("\n")
self.process.stdin.flush()
# Drain the rest of output
out, err = self.drain()
stdout.extend(out)
stderr.extend(err)
return stdout, stderr
示例13: parse_status_update
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def parse_status_update(self, message):
m = re.match(self.update_regex, message)
if m is not None:
visits = int(m.group(1))
winrate = self.flip_winrate(str_to_percent(m.group(2)))
pv = ' '.join([str(move) for move in m.group(3).split()])
logger.debug("Visited %s positions, black winrate %.2f%%, PV: %s", visits,
winrate * 100, pv)
示例14: get_meta_from_registry
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def get_meta_from_registry(app, meta_version, registry=None):
logger.debug("ready get meta version %s for app %s from registry" %
(meta_version, app))
meta_version = normalize_meta_version(meta_version)
if not registry:
registry = PRIVATE_REGISTRY
try:
y = None
c = None
cli = None
cli = get_docker_client(DOCKER_BASE_URL)
# TODO check if the image already exits
cli.pull(
repository="%s/%s" % (registry, app),
tag="meta-%s" % (meta_version, ),
insecure_registry=True
)
image = "%s/%s:meta-%s" % (registry, app, meta_version)
command = '/bin/sleep 0.1'
c = cli.create_container(image=image, command=command)
r = cli.get_archive(container=c.get('Id'), path='/lain.yaml')
tar = tarfile.open(fileobj=StringIO(r[0].data))
f = tar.extractfile('lain.yaml')
y = yaml.safe_load(f.read())
except Exception, e:
logger.error("fail get yaml from %s %s: %s" % (app, meta_version, e))
raise Exception("fail get yaml from %s %s: %s" %
(app, meta_version, e))
示例15: availabe_meta_versions
# 需要导入模块: from log import logger [as 别名]
# 或者: from log.logger import debug [as 别名]
def availabe_meta_versions(self):
logger.debug("try to get available meta version of app %s" %
self.appname)
tags = self.registry_tags
versions = {}
for k in tags:
meta_version = get_meta_version_from_tag(k)
if meta_version:
_timestamp = float(meta_version.split('-')[0])
versions[_timestamp] = meta_version
ordered_versions = collections.OrderedDict(
sorted(versions.items(), reverse=True))
logger.debug(
"finish getting available meta version of app %s" % self.appname)
return ordered_versions.values()