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


Python LOG.error方法代码示例

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


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

示例1: ebs_usage

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [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))
开发者ID:hasalexg,项目名称:aws_audit,代码行数:27,代码来源:ebs_functions.py

示例2: audit_ebs

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [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))
开发者ID:hasalexg,项目名称:aws_audit,代码行数:35,代码来源:ebs_functions.py

示例3: send_batch

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
        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,代码行数:9,代码来源:listen.py

示例4: authenticate

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
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,代码行数:13,代码来源:views.py

示例5: _cleanup

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
    def _cleanup(self):
        """ Remove old and outdated files from the temporary and
            spool directory.
        """

        if time.time() - self.cleanup_last > self.cleanup_after:
            self._lock.acquire()
            try:
                self.__cleanup()
                self.cleanup_last = time.time()
            except Exception, e:
                LOG.error(e, exc_info=True)
            finally:
开发者ID:zopyx,项目名称:zopyx.smartprintng.server,代码行数:15,代码来源:models.py

示例6: convertZIPEmail

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
def convertZIPEmail(context, auth_token, zip_archive, converter_name='pdf-prince', sender=None, recipient=None, subject=None, body=None):

    if not authorizeRequest(auth_token):
        msg = 'Authorization failed'
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)

    try:
        return context.convertZIPEmail(zip_archive, converter_name, sender, recipient, subject, body)
    except Exception, e:
        msg = 'Conversion failed (%s)' % e
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)
开发者ID:zopyx,项目名称:zopyx.smartprintng.server,代码行数:15,代码来源:views.py

示例7: convertZIP

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
def convertZIP(context, auth_token, zip_archive, converter_name='pdf-prince'):

    if not authorizeRequest(auth_token):
        msg = 'Authorization failed'
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)

    try:
        return context.convertZIP(zip_archive, converter_name)
    except Exception, e:
        msg = 'Conversion failed (%s)' % e
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)
开发者ID:zopyx,项目名称:zopyx.smartprintng.server,代码行数:15,代码来源:views.py

示例8: delete_vol

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [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))
开发者ID:hasalexg,项目名称:aws_audit,代码行数:16,代码来源:ebs_functions.py

示例9: handle_exc

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
def handle_exc(text, obj, exc_info):
    """ Handle an exception. Currently we log the exception through  our own
        logger. 'obj' is currently unused. We might use it later to obtain
        detailed informations.
    """
    
    # Add some addition object info iff available.
    # XXX: this should be replaced with a more elegant solution
    
    try:
        text = text + ' (%s)' % obj.absolute_url(1)
    except:
        pass

    LOG.error(text, exc_info=exc_info)
开发者ID:alepharchives,项目名称:zopyx.txng3.core,代码行数:17,代码来源:util.py

示例10: on_message

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [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
开发者ID:GreenDragonSoft,项目名称:network-rail-train-movements-listener,代码行数:18,代码来源:listen.py

示例11: convertZIPandRedirect

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
def convertZIPandRedirect(context, auth_token, zip_archive, converter_name='prince-pdf', prefix=None):
    """ This view appects a ZIP archive through a POST request containing all
        relevant information (similar to the XMLRPC API). However the converted
        output file is not returned to the caller but delivered "directly" through
        the SmartPrintNG server (through an URL redirection). The 'prefix'
        parameter can be used to override the basename of filename used within the
        content-disposition header.
        (This class is only a base class for the related http_ and xmlrpc_
         view (in order to avoid redudant code).)
    """

    if not authorizeRequest(auth_token):
        msg = 'Authorization failed'
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)

    try:
        output_archivename, output_filename = context._processZIP(zip_archive, converter_name)
        output_ext = os.path.splitext(output_filename)[1]

        # take ident from archive name
        ident = os.path.splitext(os.path.basename(output_archivename))[0]

        # move output file to spool directory
        dest_filename = os.path.join(context.spool_directory, '%s%s' % (ident, output_ext))
        rel_output_filename = dest_filename.replace(context.spool_directory + os.sep, '')
        shutil.move(output_filename, dest_filename)
        host = 'localhost'
        port = 6543
        prefix = prefix or ''
        location = 'http://%s:%s/deliver?filename=%s&prefix=%s' % (host, port, rel_output_filename, prefix)
        return location
    except Exception, e:
        msg = 'Conversion failed (%s)' % e
        LOG.error(msg, exc_info=True)
        return xmlrpclib.Fault(123, msg)
开发者ID:zopyx,项目名称:zopyx.smartprintng.server,代码行数:38,代码来源:views.py

示例12: _decode_stanox

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
 def _decode_stanox(stanox):
     try:
         return locations.from_stanox(stanox)
     except locations.LookupFailure:
         LOG.error('Failed to look up STANOX {}.'.format(stanox))
开发者ID:GreenDragonSoft,项目名称:refundmytrain-train-movements-handler,代码行数:7,代码来源:handle.py

示例13: __init__

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
 def __init__(self, message):
     LOG.error(message)
开发者ID:ulisesmx,项目名称:model_repair,代码行数:4,代码来源:error_handling.py

示例14: on_error

# 需要导入模块: from logger import LOG [as 别名]
# 或者: from logger.LOG import error [as 别名]
 def on_error(self, headers, message):
     LOG.error("ERROR: {} {}".format(headers, message))
开发者ID:GreenDragonSoft,项目名称:network-rail-train-movements-listener,代码行数:4,代码来源:listen.py


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