本文整理汇总了Python中logger.LOG.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.info方法的具体用法?Python LOG.info怎么用?Python LOG.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.LOG
的用法示例。
在下文中一共展示了LOG.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ebs_usage
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def ebs_usage(connect, volumes):
"""
Checks for no usage in 24 hours
"""
if type(volumes) is not list:
raise TypeError("Not a list")
unused_volumes = []
if volumes and volumes is not None:
try:
for ebs in volumes:
response = connect.cloudwatch.get_metric_statistics(Namespace='AWS/EBS',
MetricName='VolumeReadBytes',
StartTime=datetime.now() - timedelta(days=1),
EndTime=datetime.now(),
Period=86400, Statistics=['Average'],
Dimensions=[{'Name':'VolumeId','Value':ebs.id}])
if 'Datapoints' in response and not response['Datapoints']:
LOG.info("INFO: {0} is not active".format(ebs.id))
unused_volumes.append(ebs)
except Exception, err:
LOG.error("ERROR: {0}".format(err))
示例2: process_message
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [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
示例3: main
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def main():
queue = get_aws_queue(os.environ['AWS_SQS_QUEUE_URL'])
try:
handle_queue(queue)
except KeyboardInterrupt:
LOG.info("Quitting.")
示例4: audit_ebs
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def audit_ebs(connect, volumes, days=None):
"""
Creates list of volumes older than X days
Defaults to 1 week
"""
if type(volumes) is not list:
raise TypeError("Not a list")
# Sets days if not specified
if not days:
date = str(datetime.now() - timedelta(days=7))
else:
date = str(datetime.now() - timedelta(days=days))
audit_tag = [{'Key':'audit','Value':str(datetime.now())}]
unused_ebs=[]
for ebs in volumes:
try:
# Gets tags for volume
for attribute in ebs.tags:
# Searches for audit tag
if attribute.get('Key') == 'audit':
# Compares audit dates
if attribute.get('Value') < date:
LOG.info("INFO: {0} ready for deletion" .format(ebs.id))
unused_ebs.append(ebs.id)
# Tags volume if missing audit tag
else:
LOG.info("INFO: Audit tag added to {0}" .format(ebs.id))
ebs.create_tags(Tags=audit_tag)
except Exception, err:
LOG.error("ERROR: {0}".format(err))
示例5: on_modified
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def on_modified(self, event):
path = event.src_path
dest_path = path.replace(".less", ".css")
cmd = 'lessc "%s" "%s"' % (path, dest_path)
status = os.system(cmd)
LOG.info(cmd)
LOG.info("Status : %d" % status)
示例6: increment_message_counter
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def increment_message_counter(self, num_bytes):
self.sent_message_count += 1
self.sent_bytes += num_bytes
if self.sent_message_count % LOG_EVERY_N_MESSAGES == 0:
LOG.info('Sent {} messages, ~{:.3f} MB'.format(
self.sent_message_count,
self.sent_bytes / (1024 * 1024)))
示例7: _run_lola
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def _run_lola(self, lola_file_name, formula):
"""
Run LoLA for a certain file and formula
"""
LOG.info("Running LoLA in temporal file for formula:")
LOG.info("'{0}'".format(formula))
command = ["lola", lola_file_name, "--formula={0}".format(formula)]
(ret, _, stderr) = run(command)
return check_result(stderr)
示例8: __init__
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def __init__(self, phi_1, phi_2):
if not isinstance(phi_1, CTLFormula):
err_message = "Phi provided is not an CTL formula"
raise CTLException(err_message)
if not isinstance(phi_2, CTLFormula):
err_message = "Phi provided is not an CTL formula"
raise CTLException(err_message)
self._phi_1 = phi_1
self._phi_2 = phi_2
LOG.info("New negated exist until predicate created")
示例9: _create_lola_file
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def _create_lola_file(self, m_0):
"""
Create a LoLA file of the model.
"""
LOG.info("Creating LoLA temporal file")
lola_file_name = "__tmp_lola_model_.lola"
file_object = open(lola_file_name, "wb")
file_object.write(self.export_lola(m_0));
file_object.close()
LOG.info("LoLA temporal file created")
return lola_file_name
示例10: model_checking
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def model_checking(self, m_0, formula):
"""
Perform model checking of the petri net for a certain marking and
formula using lola.
"""
lola_file_name = self._create_lola_file(m_0)
result = self._run_lola(lola_file_name, formula.print_lola())
LOG.info("Model Checking result: \"{0}\"".format(result))
os.remove(lola_file_name)
LOG.info("Removing LoLA temporal file")
return result
示例11: load_file
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def load_file(self, file_name):
"""
Load a Petri Net model dumped into a JSON file with name 'file_name'.
"""
msg = "Loading Petri Net from file '{0}'".format(file_name)
LOG.info(msg)
with open(file_name) as in_file:
in_dict = json.load(in_file)
self._places = in_dict["P"]
self._transitions = in_dict["T"]
self._input = self._read_io_dict("I", in_dict["I"])
self._output = self._read_io_dict("O", in_dict["O"])
msg = "Loading completed"
LOG.info(msg)
示例12: reachability_set
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def reachability_set(self, m_0):
"""
Get the reachability set of the model for marking 'm'.
"""
m_0 = self._fix_marking(m_0)
msg = "Getting reachability set from '{0}'".format(m_0)
LOG.info(msg)
reach_graph = {str(m_0): []}
open_set = [m_0]
closed_set = []
while len(open_set):
m = open_set.pop(0)
if m in closed_set:
continue
m_key = str(m)
msg = "Adding new marking to reachability set: '{0}'".format(m)
LOG.info(msg)
reach_graph[m_key] = self._get_succesors(m)
open_set.extend(reach_graph[m_key])
closed_set.append(m)
msg = "Reachability set calculated from: '{0}'".format(m_0)
LOG.info(msg)
msg = "Reachability set size is: '{0}'".format(len(reach_graph))
LOG.info(msg)
return reach_graph
示例13: delete_vol
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def delete_vol(connect, volumes):
"""
Deletes Volumes Passed
"""
if type(volumes) is not list:
raise TypeError("Not a list")
# Currently only printing id
for ebs in volumes:
try:
LOG.info("INFO: {0} would have been deleted" .format(ebs))
except Exception, err:
LOG.error("ERROR: {0}".format(err))
示例14: save_file
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def save_file(self, file_name):
"""
Dump the Petri Net model into a JSON file with name 'file_name'.
"""
msg = "Dumping Petri Net into file '{0}'".format(file_name)
LOG.info(msg)
out_dict = {}
out_dict["P"] = self._places
out_dict["T"] = self._transitions
out_dict["I"] = self._get_io_dict("I")
out_dict["O"] = self._get_io_dict("O")
with open(file_name, "w+") as out_file:
json.dump(out_dict, out_file)
msg = "Dumping completed"
LOG.info(msg)
示例15: add_place
# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import info [as 别名]
def add_place(self, place):
"""
Function to add places to P set if not already in it. If 'place' is not
an string, this function will raise an exception.
"""
if not isinstance(place, basestring):
err_message = "Place provided is not an string"
raise PetriNetException(err_message)
if place not in self._places:
self._places.append(place)
for transition in self._transitions:
self.change_input_flow(place, transition, 0)
self.change_output_flow(place, transition, 0)
LOG.info("Place '{0}' added to P set".format(place))
else:
LOG.info("Place '{0}' already in P set".format(place))