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


Python log.msg方法代码示例

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


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

示例1: _getGitHubRepoProperties

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def _getGitHubRepoProperties(self, build):
        """
        Return a dictionary with GitHub related properties from `build`.
        """
        repoOwner, repoName, sha = yield defer.gatherResults([
            build.render(self._repoOwner),
            build.render(self._repoName),
            build.render(self._sha),
        ])

        if not repoOwner or not repoName:
            defer.returnValue({})

        if not sha:
            log.msg('GitHubStatus: No revision found.')
            defer.returnValue({})

        result = {
            'repoOwner': repoOwner,
            'repoName': repoName,
            'sha': sha,
            'targetURL': self._status.getURLForThing(build),
            'buildNumber': str(build.getNumber()),
        }
        defer.returnValue(result) 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:27,代码来源:github.py

示例2: _sendGitHubStatus

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [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 msg [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: _get_changes

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def _get_changes(self):
        log.msg('LLVMGitPoller: polling git repo at %s' % self.repourl)

        self.lastPoll = time.time()

        # get a deferred object that performs the fetch
        args = ['fetch', 'origin']
        self._extend_with_fetch_refspec(args)

        # This command always produces data on stderr, but we actually do not care
        # about the stderr or stdout from this command. We set errortoo=True to
        # avoid an errback from the deferred. The callback which will be added to this
        # deferred will not use the response.
        d = utils.getProcessOutput(self.gitbin, args,
                    path=self.workdir,
                    env=dict(PATH=os.environ['PATH']), errortoo=True )

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

示例5: poll

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [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

示例6: getChanges

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def getChanges(self, request):
        secret = None
        if isinstance(self.options, dict):
            secret = self.options.get('secret')
        try:
            content = request.content.read()
            payload = json.loads(bytes2unicode(content))
        except Exception as exception:
            raise ValueError('Error loading JSON: ' + str(exception))
        if secret is not None and secret != payload['secret']:
            raise ValueError('Invalid secret')
        event_type = bytes2unicode(request.getHeader(_HEADER_EVENT_TYPE))
        log.msg("Received event '{}' from gitea".format(event_type))

        codebases = request.args.get('codebase', [None])
        codebase = bytes2unicode(codebases[0])
        changes = []

        handler_function = getattr(self, 'process_{}'.format(event_type), None)
        if not handler_function:
            log.msg("Ignoring gitea event '{}'".format(event_type))
        else:
            changes = handler_function(payload, event_type, codebase)

        return (changes, 'git') 
开发者ID:lab132,项目名称:buildbot-gitea,代码行数:27,代码来源:webhook.py

示例7: extendarduinolist

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def extendarduinolist(self, idnum):
        from os.path import expanduser
        home = expanduser("~")

        martasdir = [path for path, dirs, files in os.walk(home) if path.endswith('MARTAS')][0]
        arduinosensorfile = os.path.join(martasdir,'arduinolist.csv')
        log.msg('Checking Arduinofile: %s' % arduinosensorfile)
        arduinolist = []
        sensorelement = []
        try:
            arduinolist = self.loadarduinolist(arduinosensorfile)
            sensorelement = [elem[0] for elem in arduinolist]
            print("Liste", sensorelement)
        except:
            log.msg('Arduino: No Sensor list so far -or- Error while getting sensor list')
            pass
        if not self.sensordict[idnum] in sensorelement:
            arduinolist.append([self.sensordict[idnum], self.keydict[idnum]])
            self.savearduinolist(arduinosensorfile,arduinolist) 
开发者ID:geomagpy,项目名称:magpy,代码行数:21,代码来源:arduinoprotocol.py

示例8: owConnected

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def owConnected(self):
            global owsensorlist
            try:
                self.root = ow.Sensor('/').sensorList()

                if not (self.root == owsensorlist):
                    log.msg('Rereading sensor list')
                    ow.init(self.source)
                    self.root = ow.Sensor('/').sensorList()
                    owsensorlist = self.root
                    self.connectionMade(self.root)
                self.reconnectcount = 0
            except:
                self.reconnectcount = self.reconnectcount + 1
                log.msg('Reconnection event triggered - Number: %d' % self.reconnectcount)
                time.sleep(2)
                if self.reconnectcount < 10:
                    self.owConnected()
                else:
                    print("owConnect: reconnection not possible")

            self.oneWireInstruments(self.root) 
开发者ID:geomagpy,项目名称:magpy,代码行数:24,代码来源:owprotocol.py

示例9: lineReceived

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [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

示例10: _timeToArray

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def _timeToArray(self,timestring):
        '''
        Converts time string of format 2013-12-12T23:12:23.122324
        to an array similiar to a datetime object
        '''

        try:
            splittedfull = timestring.split(' ')
            splittedday = splittedfull[0].split('-')
            splittedsec = splittedfull[1].split('.')
            splittedtime = splittedsec[0].split(':')
            datearray = splittedday + splittedtime
            datearray.append(splittedsec[1])
            datearray = map(int,datearray)
            return datearray
        except:
            log.msg('Error while extracting time array')
            return [] 
开发者ID:geomagpy,项目名称:magpy,代码行数:20,代码来源:lemiprotocol.py

示例11: _timeToArray

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def _timeToArray(timestring):
    '''
    Converts time string of format 2013-12-12T23:12:23.122324
    to an array similiar to a datetime object
    '''

    try:
        splittedfull = timestring.split(' ')
        splittedday = splittedfull[0].split('-')
        splittedsec = splittedfull[1].split('.')
        splittedtime = splittedsec[0].split(':')
        datearray = splittedday + splittedtime
        datearray.append(splittedsec[1])
        datearray = map(int,datearray)
        return datetime(*datearray)
    except:
        log.msg('Error while extracting time array')
        return [] 
开发者ID:geomagpy,项目名称:magpy,代码行数:20,代码来源:pos1protocol.py

示例12: set_account

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def set_account(self, account_name, callback):
        if account_name in self.accounts:
            if account_name != self.current_account:
                self.current_account = account_name
                msg = 'current account set to %s' % account_name
                self.output(msg)
                self.WriteAllClients('current-account: %s' %
                                     self.current_account)
            ret = True
        else:
            msg = 'account %s not found' % account_name
            self.output('Error: set_account(): %s' % msg)
            ret = False
        if callback:
            TWS_Callback(self, 0, 'current-account', callback).complete(ret)
        else:
            return ret 
开发者ID:rstms,项目名称:txTrader,代码行数:19,代码来源:tws.py

示例13: _getSingleBranchAutomaticSchedulers

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def _getSingleBranchAutomaticSchedulers(
        builders_with_automatic_schedulers,
        filter_branch,
        treeStableTimer):

    automatic_schedulers = []

    # Do we have any to take care of?
    if builders_with_automatic_schedulers:
        # Let's reconsile first to get a unique set of dependencies.
        # We need a set of unique sets of dependent projects.
        set_of_dependencies = set([
            frozenset(getattr(b['factory'], 'depends_on_projects'))
            for b in builders_with_automatic_schedulers
        ])

        for projects in set_of_dependencies:
            sch_builders = [
                b['name']
                for b in builders_with_automatic_schedulers
                if frozenset(getattr(b['factory'], 'depends_on_projects')) == projects
            ]

            automatic_scheduler_name =  filter_branch + ":" + ",".join(sorted(projects))
            projects_to_filter = getProjectsToFilter(projects)

            automatic_schedulers.append(
                SingleBranchScheduler(
                    name=automatic_scheduler_name,
                    treeStableTimer=treeStableTimer,
                    builderNames=sch_builders,
                    change_filter=ChangeFilter(project=projects_to_filter, branch=filter_branch)
                )
            )

            log.msg(
                "Generated SingleBranchScheduler: { name='%s'" % automatic_scheduler_name,
                ", builderNames=", sch_builders,
                ", change_filter=", projects_to_filter, " (branch: %s)" % filter_branch,
                "}")
    return automatic_schedulers 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:43,代码来源:schedulers.py

示例14: makeRequest

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def makeRequest(self, url_args, post=None, method='GET', page=0):
        headers = self._makeHeaders()

        url = self._baseURL
        url += '/'.join(url_args)
        if page:
            url += "?page=%d" % page

        postdata = None
        if post:
            postdata = json.dumps(post)

        log.msg("fetching '%s'" % (url,), system='github')
        factory = _GithubHTTPClientFactory(url, headers=headers,
                    postdata=postdata, method=method,
                    agent='txgithub', followRedirect=0,
                    timeout=30)

        self.reactor.connectSSL(factory.host, factory.port, factory,
                                self.contextFactory)
        d = factory.deferred
        @d.addCallback
        def check_ratelimit(data):
            self.last_response_headers = factory.response_headers
            remaining = int(factory.response_headers.get(
                                    'x-ratelimit-remaining', [0])[0])
            if remaining < 100 and not self.rateLimitWarningIssued:
                log.msg("warning: only %d Github API requests remaining "
                        "before rate-limiting" % remaining)
                self.rateLimitWarningIssued = True
            return data
        @d.addCallback
        def un_json(data):
            if data:
                return json.loads(data)
        return d 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:38,代码来源:api.py

示例15: startService

# 需要导入模块: from twisted.python import log [as 别名]
# 或者: from twisted.python.log import msg [as 别名]
def startService(self):
        StatusReceiverMultiService.startService(self)
        self._status = self.parent.getStatus()
        self._status.subscribe(self)
        log.msg("GitHubStatus: Service started.") 
开发者ID:llvm,项目名称:llvm-zorg,代码行数:7,代码来源:github.py


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