本文整理汇总了Python中logger.LOG.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.debug方法的具体用法?Python LOG.debug怎么用?Python LOG.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.LOG
的用法示例。
在下文中一共展示了LOG.debug方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_message
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def process_message(raw_message):
header = raw_message['header']
if not validate_header(header):
return True # Effectively drop the message
decoded = TrainMovementsMessage(raw_message['body'])
if (decoded.event_type == EventType.arrival and
decoded.status == VariationStatus.late and
decoded.location.is_public_station and
decoded.operating_company and
decoded.operating_company.is_delay_repay_eligible(
decoded.minutes_late)):
LOG.info('{} {} arrival at {} ({}) - eligible for '
'compensation from {}: {}'.format(
decoded.actual_datetime,
decoded.early_late_description,
decoded.location.name,
decoded.location.three_alpha,
decoded.operating_company,
str(decoded)))
else:
LOG.debug('Dropping {} {} {} message'.format(
decoded.status, decoded.event_type,
decoded.early_late_description))
return True
示例2: _handle_multiple_messages
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def _handle_multiple_messages(self, messages):
"""
Train movement message comprises a `header` and a `body`. The `header`
http://nrodwiki.rockshore.net/index.php/Train_Movement
"""
def send_batch(sqs_entries):
# http://boto3.readthedocs.org/en/latest/reference/services/sqs.html#SQS.Queue.sendentries
result = self.queue.send_messages(Entries=sqs_entries)
if len(result['Successful']) != len(sqs_entries):
LOG.error('Some messages failed to send to SQS: {}'.format(
result))
with batcher(send_batch, batch_size=10) as b:
for raw_message in messages:
message_id = str(uuid.uuid4())
pretty_message = json.dumps(raw_message, indent=4)
LOG.debug('Sending to queue with id {}: {}'.format(
message_id, pretty_message))
b.push({
'Id': message_id,
'MessageBody': pretty_message
})
self.increment_message_counter(len(raw_message))
示例3: _check_xinc
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def _check_xinc():
if not checkEnvironment("XINC_HOME"):
return False
exe_name = win32 and "\\bin\\windows\\xinc.exe" or "bin/unix/xinc"
full_exe_name = os.path.join(xinc_home, exe_name)
if not os.path.exists(full_exe_name):
LOG.debug("%s does not exist" % full_exe_name)
return False
return True
示例4: _check_fop
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def _check_fop():
if not checkEnvironment('FOP_HOME'):
return False
exe_name = win32 and 'fop.bat' or 'fop'
full_exe_name = os.path.join(fop_home, exe_name)
if not os.path.exists(full_exe_name):
LOG.debug('%s does not exist' % full_exe_name)
return False
return True
示例5: _check_xfc
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def _check_xfc():
if not checkEnvironment("XFC_DIR"):
return False
# check only for fo2rtf (we expect that all other fo2XXX
# converters are also installed properly)
full_exe_name = os.path.join(xfc_dir, "fo2rtf")
if not os.path.exists(full_exe_name):
LOG.debug("%s does not exist" % full_exe_name)
return False
return True
示例6: checkEnvironment
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def checkEnvironment(envname):
""" Check if the given name of an environment variable exists and
if it points to an existing directory.
"""
dirname = os.environ.get(envname, None)
if dirname is None:
LOG.debug('Environment variable $%s is unset' % envname)
return False
if not os.path.exists(dirname):
LOG.debug('The directory referenced through the environment '
'variable $%s does not exit (%s)' %
(envname, dirname))
return False
return True
示例7: on_message
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def on_message(self, stomp_headers, json_encoded_messages):
LOG.debug('STOMP headers {}'.format(stomp_headers))
try:
messages = json.loads(json_encoded_messages)
except ValueError as e:
LOG.error('Failed to decode {} bytes as JSON: {}'.format(
len(json_encoded_messages), json_encoded_messages))
LOG.exception(e)
return
try:
self._handle_multiple_messages(messages)
except Exception as e:
LOG.exception(e)
return
示例8: search_es
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def search_es(max_gens, pop_range, ad_mut_stp, mu_lambda):
pop = init_population(pop_range)
best = fitness_func(pop[0])
p = 1.5
for gen in range(0, max_gens-1):
children = mutate(pop[0], pop[1], p)
LOG.debug("children>{0}".format(children))
fitness = fitness_func(children[0])
if fitness <= best:
best = fitness
pop = children
p = 1.5
else:
p = 1.5 ** (-1/4)
if mu_lambda:
pop = init_population(pop_range)
best = fitness_func(pop[0])
LOG.rbf("Generation>{0}:new best>{1}".format(gen, best))
return best
示例9: validate_header
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import debug [as 别名]
def validate_header(header):
"""
```
"header": {
"user_id": "",
"msg_type": "0003",
"msg_queue_timestamp": "1455883630000",
"source_dev_id": "",
"original_data_source": "SMART",
"source_system_id": "TRUST"
}
```
"""
if header['msg_type'] != '0003':
LOG.debug('Dropping unsupported message type `{}`'.format(
header['msg_type']))
return False
return True