当前位置: 首页>>代码示例>>Python>>正文


Python logger.LOG类代码示例

本文整理汇总了Python中logger.LOG的典型用法代码示例。如果您正苦于以下问题:Python LOG类的具体用法?Python LOG怎么用?Python LOG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LOG类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _handle_multiple_messages

    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))
开发者ID:GreenDragonSoft,项目名称:network-rail-train-movements-listener,代码行数:28,代码来源:listen.py

示例2: send_batch

        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))
开发者ID:GreenDragonSoft,项目名称:network-rail-train-movements-listener,代码行数:7,代码来源:listen.py

示例3: ebs_usage

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))
开发者ID:hasalexg,项目名称:aws_audit,代码行数:25,代码来源:ebs_functions.py

示例4: on_modified

 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)
开发者ID:zopyx,项目名称:lesscss.py,代码行数:7,代码来源:lesscss.py

示例5: main

def main():
    queue = get_aws_queue(os.environ['AWS_SQS_QUEUE_URL'])

    try:
        handle_queue(queue)
    except KeyboardInterrupt:
        LOG.info("Quitting.")
开发者ID:GreenDragonSoft,项目名称:refundmytrain-train-movements-handler,代码行数:7,代码来源:handle.py

示例6: process_message

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
开发者ID:GreenDragonSoft,项目名称:refundmytrain-train-movements-handler,代码行数:30,代码来源:handle.py

示例7: increment_message_counter

    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)))
开发者ID:GreenDragonSoft,项目名称:network-rail-train-movements-listener,代码行数:8,代码来源:listen.py

示例8: _run_lola

 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)
开发者ID:ulisesmx,项目名称:model_repair,代码行数:9,代码来源:petri_net.py

示例9: __init__

 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")
开发者ID:ulisesmx,项目名称:model_repair,代码行数:10,代码来源:ctl.py

示例10: authenticate

def authenticate(context, username, password):

    if not have_authentication:
        return True

    try:
        return authenticateRequest(username, password)
    except Exception, e:
        msg = 'Authentication failed (%s)' % e
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)
开发者ID:zopyx,项目名称:zopyx.smartprintng.server,代码行数:11,代码来源:views.py

示例11: _check_fop

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
开发者ID:dnouri,项目名称:zopyx.convert2,代码行数:11,代码来源:fop.py

示例12: _check_xinc

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
开发者ID:zopyx,项目名称:zopyx.convert2,代码行数:11,代码来源:xinc.py

示例13: _create_lola_file

 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
开发者ID:ulisesmx,项目名称:model_repair,代码行数:11,代码来源:petri_net.py

示例14: model_checking

 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
开发者ID:ulisesmx,项目名称:model_repair,代码行数:11,代码来源:petri_net.py

示例15: _check_xfc

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
开发者ID:zopyx,项目名称:zopyx.convert2,代码行数:12,代码来源:xfc.py


注:本文中的logger.LOG类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。