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