當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。