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


Python log.err方法代码示例

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


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

示例1: buildFinished

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def buildFinished(self, builderName, build, results):
        """
        See: C{IStatusReceiver}.
        """
        if self._builders_to_report and (builderName not in self._builders_to_report):
            # Build finished on a builder we do not care of.
            return # skip unless white listed

        # For now we report only properly completed builds without buildbot errors.
        if results != SUCCESS and results != FAILURE:
            return # skip error builds

        d = self._sendFinishStatus(builderName, build, results)
        d.addErrback(log.err,
                     'GitHubStatus: While sending finish status to GitHub for %s.' %
                     (builderName,)) 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:18,代码来源:github.py

示例2: _sendGitHubStatus

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def _sendGitHubStatus(self, status):
        """
        Send status to GitHub API.
        """
        d = self._github.repos.createStatus(
            repo_user=status['repoOwner'].encode('utf-8'),
            repo_name=status['repoName'].encode('utf-8'),
            sha=status['sha'].encode('utf-8'),
            state=status['state'].encode('utf-8'),
            target_url=status['targetURL'].encode('utf-8'),
            description=status['description'].encode('utf-8'),
            context=status['builderName'].encode('utf-8'),
        )

        success_message = (
            'GitHubStatus: Status "%(state)s" sent for '
            '%(repoOwner)s/%(repoName)s at %(sha)s.'
        ) % status
        error_message = (
            'GitHubStatus: Fail to send status "%(state)s" for '
            '%(repoOwner)s/%(repoName)s at %(sha)s.'
        ) % status
        d.addCallback(lambda result: log.msg(success_message))
        d.addErrback(lambda failure: log.err(failure, error_message))
        return d 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:27,代码来源:github.py

示例3: startService

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def startService(self):
        # make our workdir absolute, relative to the master's basedir
        if not os.path.isabs(self.workdir):
            self.workdir = os.path.join(self.master.basedir, self.workdir)
            log.msg("LLVMGitPoller: using workdir '%s'" % self.workdir)

        # initialize the repository we'll use to get changes; note that
        # startService is not an event-driven method, so this method will
        # instead acquire self.initLock immediately when it is called.
        if not os.path.exists(self.workdir + r'/.git'):
            d = self.initRepository()
            d.addErrback(log.err, 'while initializing LLVMGitPoller repository')
        else:
            log.msg("LLVMGitPoller repository already exists")

        # call this *after* initRepository, so that the initLock is locked first
        base.PollingChangeSource.startService(self) 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:19,代码来源:llvmgitpoller.py

示例4: poll

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def poll(self):
        # Return value is only used for unit testing.
        if self.projects:
            log.msg("LLVMPoller(%s): Polling %s projects" % (self.svnurl, self.projects))
        else:
            log.msg("LLVMPoller(%s): Polling all projects" % self.svnurl)

        d = defer.succeed(None)

        d.addCallback(self.get_logs)
        d.addCallback(self.parse_logs)
        d.addCallback(self.get_new_logentries)
        d.addCallback(self.create_changes)
        d.addCallback(self.submit_changes)
        d.addCallback(self.finished_ok)
        d.addErrback(log.err, 'LLVMPoller: Error in  while polling') # eat errors

        return d 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:20,代码来源:llvmpoller.py

示例5: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("Protocol: Error while saving file")        


## meteolabor BM35 protocol
## 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:bm35protocol.py

示例6: lineReceived

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def lineReceived(self, line):
        dispatch_url =  "http://example.com/"+self.hostname+"/bm3#"+self.sensor+"-value"
        try:
            evt1, evt35, evt99 = self.processData(line)
        except ValueError:
            log.err('BM35 - Protocol: Unable to parse data %s' % line)
        except:
            pass

        try:
            ## publish event to all clients subscribed to topic
            ##
            self.wsMcuFactory.dispatch(dispatch_url, evt1)
            #self.wsMcuFactory.dispatch(dispatch_url, evt3)
            self.wsMcuFactory.dispatch(dispatch_url, evt35)
            self.wsMcuFactory.dispatch(dispatch_url, evt99)
        except:
            log.err('BM35 - Protocol: wsMcuFactory error while dispatching data.') 
开发者ID:geomagpy,项目名称:magpy,代码行数:20,代码来源:bm35protocol.py

示例7: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("PalmAcq - Protocol: Error while saving file")


## PalmAcq protocol
## -------------------- 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:palmacqprotocol.py

示例8: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("KERN - Protocol: Error while saving file")        


## Environment protocol
## -------------------- 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:kernprotocol.py

示例9: dataToCSV

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToCSV(self, sensorid, filedate, asciidata, header):
                # File Operations
                #try:
                path = os.path.join(self.outputdir,self.hostname,sensorid)
                if not os.path.exists(path):
                    os.makedirs(path)
                savefile = os.path.join(path, sensorid+'_'+filedate+".asc")
                asciilist = asciidata.split(';')
                if not os.path.isfile(savefile):
                    with open(savefile, "wb") as csvfile:
                        writer = csv.writer(csvfile,delimiter=';')
                        writer.writerow(header)
                        writer.writerow(asciilist)
                else:
                    with open(savefile, "a") as csvfile:
                        writer = csv.writer(csvfile,delimiter=';')
                        writer.writerow(asciilist)
                #except:
                #log.err("datatoCSV: Error while saving file") 
开发者ID:geomagpy,项目名称:magpy,代码行数:21,代码来源:callprotocol.py

示例10: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("Arduino - Protocol: Error while saving file")


## Arduino protocol
## -------------------- 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:arduinoprotocol.py

示例11: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("OW - Protocol: Error while saving file")


## Environment protocol
## -------------------- 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:envprotocol.py

示例12: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(sensorid, filedate, bindata, header):
    # File Operations
    try:
        subdirname = socket.gethostname()
        path = os.path.join(outputdir,subdirname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("OW - Protocol: Error while saving file") 
开发者ID:geomagpy,项目名称:magpy,代码行数:20,代码来源:cobs_ws_protocols.py

示例13: lineReceived

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def lineReceived(self, line):
        dispatch_url =  "http://example.com/"+hostname+"/cs#"+self.sensor+"-value"
        try:
            data = line.strip('$').split(',')
            evt1, evt4 = self.processData(data)
        except ValueError:
            log.err('CS - Protocol: Unable to parse data %s' % line)
            #return
        except:
            pass


        if evt1['value'] and evt4['value']:
            try:
                ## publish event to all clients subscribed to topic
                ##
                self.wsMcuFactory.dispatch(dispatch_url, evt1)
                self.wsMcuFactory.dispatch(dispatch_url, evt4)
                #log.msg("Analog value: %s" % str(evt4))
            except:
                log.err('CS - Protocol: wsMcuFactory error while dispatching data.') 
开发者ID:geomagpy,项目名称:magpy,代码行数:23,代码来源:cobs_ws_protocols.py

示例14: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("OW - Protocol: Error while saving file")


## Caesium protocol
## 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:csprotocol.py

示例15: dataToFile

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import err [as 别名]
def dataToFile(outputdir, sensorid, filedate, bindata, header):
    # File Operations
    try:
        hostname = socket.gethostname()
        path = os.path.join(outputdir,hostname,sensorid)
        # outputdir defined in main options class
        if not os.path.exists(path):
            os.makedirs(path)
        savefile = os.path.join(path, sensorid+'_'+filedate+".bin")
        if not os.path.isfile(savefile):
            with open(savefile, "wb") as myfile:
                myfile.write(header + "\n")
                myfile.write(bindata + "\n")
        else:
            with open(savefile, "a") as myfile:
                myfile.write(bindata + "\n")
    except:
        log.err("OW - Protocol: Error while saving file")


## GEM -GSM90 protocol
## 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:gsm90protocol.py


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