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


Python protocol.log函数代码示例

本文整理汇总了Python中tcf.protocol.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: doneGetContext

 def doneGetContext(self, token, error, ctx):
     pending.remove(token)
     if error:
         protocol.log("Error from Registers.getContext", error)
     else:
         print ctx
         if ctx.isReadable() and not ctx.isReadOnce() and ctx.getSize() >= 2:
             locs = []
             locs.append(registers.Location(ctx.getID(), 0, 1))
             locs.append(registers.Location(ctx.getID(), 1, 1))
             class DoneGetM(registers.DoneGet):
                 def doneGet(self, token, error, value):
                     pending.remove(token)
                     if error:
                         protocol.log("Error from Registers.getm", error)
                     else:
                         print "getm", ctx.getID(), map(ord, value)
                     if not pending:
                         onDone()
             pending.append(regs.getm(locs, DoneGetM()))
         if ctx.isWriteable() and not ctx.isWriteOnce() and ctx.getSize() >= 2:
             locs = []
             locs.append(registers.Location(ctx.getID(), 0, 1))
             locs.append(registers.Location(ctx.getID(), 1, 1))
             class DoneSetM(registers.DoneSet):
                 def doneGet(self, token, error):
                     pending.remove(token)
                     if error:
                         protocol.log("Error from Registers.setm", error)
                     if not pending:
                         onDone()
             pending.append(regs.setm(locs, (255, 255), DoneSetM()))
     if not pending:
         onDone()
开发者ID:eswartz,项目名称:emul,代码行数:34,代码来源:BasicTests.py

示例2: doneGet

 def doneGet(self, token, error, mmap):
     if error:
         protocol.log("Error from PathMap.get", error)
     else:
         print mmap
     with lock:
         lock.notify()
开发者ID:deviprasad742,项目名称:tcf,代码行数:7,代码来源:BasicTests.py

示例3: __init__

 def __init__(self, service, name, data):
     self.service = service
     self.name = name
     try:
         self.args = channel.fromJSONSequence(data)
     except Exception as x:
         protocol.log("Error decoding event data", x)
开发者ID:eswartz,项目名称:emul,代码行数:7,代码来源:event.py

示例4: doneGetContext

            def doneGetContext(self, token, error, context):
                pending.remove(token)
                if error:
                    protocol.log("Error from RunControl.getContext", error)
                else:
                    print context

                class DoneGetState(runcontrol.DoneGetState):

                    def doneGetState(self, token, error, suspended, pc, reason,
                                     params):
                        pending.remove(token)
                        if error:
                            protocol.log(
                                "Error from RunControl.getState", error)
                        else:
                            print "suspended: ", suspended
                            print "pc:        ", pc
                            print "reason:    ", reason
                            print "params:    ", params
                        if suspended:
                            _suspended.append(context.getID())
                        if len(pending) == 0:
                            with lock:
                                lock.notify()
                if context and context.hasState():
                    pending.append(context.getState(DoneGetState()))
                if len(pending) == 0:
                    with lock:
                        lock.notify()
开发者ID:deviprasad742,项目名称:tcf,代码行数:30,代码来源:BasicTests.py

示例5: doneGetChildren

 def doneGetChildren(self, token, error, context_ids):
     if error:
         protocol.log("Error from Processes.GetChildren", error)
     else:
         print "Processes:", context_ids
     with lock:
         lock.notify()
开发者ID:deviprasad742,项目名称:tcf,代码行数:7,代码来源:BasicTests.py

示例6: _log

 def _log(self, msg, x):
     if not self._alive: return
     # Don't report same error multiple times to avoid filling up the log file.
     with self._error_log_lock:
         if msg in self.error_log: return
         self.error_log.add(msg)
     protocol.log(msg, x)
开发者ID:eswartz,项目名称:emul,代码行数:7,代码来源:LocatorService.py

示例7: doneCommand

 def doneCommand(self, token, error):
     if error:
         protocol.log("Error from RunControl.resume", error)
     else:
         context.suspend(runcontrol.DoneCommand())
     with lock:
         lock.notify()
开发者ID:deviprasad742,项目名称:tcf,代码行数:7,代码来源:BasicTests.py

示例8: doneGet

 def doneGet(self, token, error, value):
     pending.remove(token)
     if error:
         protocol.log("Error from Registers.getm", error)
     else:
         print "getm", ctx.getID(), map(ord, value)
     if not pending:
         onDone()
开发者ID:eswartz,项目名称:emul,代码行数:8,代码来源:BasicTests.py

示例9: __traceMessageReceived

 def __traceMessageReceived(self, m):
     for l in self.trace_listeners:
         try:
             id = None
             if m.token is not None:
                 id = m.token.getID()
             l.onMessageReceived(m.type, id, m.service, m.name, m.data)
         except Exception as x:
             protocol.log("Exception in channel listener", x)
开发者ID:eswartz,项目名称:emul,代码行数:9,代码来源:AbstractChannel.py

示例10: doneCommand

            def doneCommand(self, token, error):
                """Called when run control command execution is complete.

                :param token: pending command handle.
                :param error: command execution error or **None**.
                """
                if error:
                    protocol.log("Error from RunContext.resume", error)
                with condition:
                    condition.notify()
开发者ID:ppalaga,项目名称:tcf,代码行数:10,代码来源:ProcessStart.py

示例11: doneGetChildren

 def doneGetChildren(self, token, error, context_ids):
     pending.remove(token)
     if error:
         protocol.log("Error from RunControl.GetChildren", error)
     else:
         for c in context_ids:
             contexts.append(c)
             pending.append(rc.getChildren(c, self))
     if len(pending) == 0:
         cache.set(None, None, contexts)
开发者ID:eswartz,项目名称:emul,代码行数:10,代码来源:BasicTests.py

示例12: trace

def trace(msg):
    """
    Trace hooks should use this method to log a message. It prepends the
    message with a timestamp and sends it to the TCF logger facility. The
    logger implementation may or may not inject its own timestamp. For
    tracing, we definitely need one, so we introduce a minimal, relative-time
    stamp.

    @param msg  the trace message
    """
    protocol.log('%s %s' % (getDebugTime(), msg))
开发者ID:wind-river-cdt,项目名称:tcf,代码行数:11,代码来源:logging.py

示例13: doneSubscribe

            def doneSubscribe(self, token, error):
                """Called when stream subscription is done.

                :param token: pending command handle
                :param error: error description if operation failed, **None**
                              if succeeded.
                """
                if error:
                    protocol.log("Error from streams.subscribe()", error)
                with condition:
                    condition.notify()
开发者ID:ppalaga,项目名称:tcf,代码行数:11,代码来源:ProcessStart.py

示例14: sendPeerRemovedEvent

 def sendPeerRemovedEvent(self):
     for l in protocol.getLocator().getListeners():
         try:
             l.peerRemoved(self.rw_attrs.get(ATTR_ID))
         except Exception as x:
             protocol.log("Unhandled exception in Locator listener", x)
     try:
         args = [self.rw_attrs.get(ATTR_ID)]
         protocol.sendEvent(locator.NAME, "peerRemoved", json.dumps(args))
     except IOError as x:
         protocol.log("Locator: failed to send 'peerRemoved' event", x)
开发者ID:eswartz,项目名称:emul,代码行数:11,代码来源:peer.py

示例15: doneGet

 def doneGet(self, token, error, value):
     pending.remove(token)
     if error:
         protocol.log(
             "Error from Registers.getm",
             error)
     else:
         print("getm " + str(ctx.getID()) +
               " " +
               str(list(map(int, value))))
     if not pending:
         onDone()
开发者ID:eclipse,项目名称:tcf,代码行数:12,代码来源:BasicTests.py


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