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


Python CloudLog.debug方法代码示例

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


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

示例1: play

# 需要导入模块: import CloudLog [as 别名]
# 或者: from CloudLog import debug [as 别名]
def play(file_name):
  try:
    if file_name is not None:
      cmd = "mplayer -ao alsa -really-quiet -noconsolecontrols "
      call(cmd+file_name, shell=True)
      CloudLog.debug("SoundSystem", file_name)
  except Exception, e:
    CloudLog.error("SoundSystem.Play", "Error playing sound", e)
开发者ID:Dean-Jansen,项目名称:PiHomeControl,代码行数:10,代码来源:SoundSystem.py

示例2: _getClient

# 需要导入模块: import CloudLog [as 别名]
# 或者: from CloudLog import debug [as 别名]
 def _getClient(self):
     CloudLog.debug(self._component, "Connecting.")
     try:
         client = HarmonyClient.create_and_connect_client(self._ip_address, self._port, self._uuid)
         CloudLog.debug(self._component, "Connected.")
         return client
     except Exception, e:
         CloudLog.error(self._component, "Error connecting to the Harmony Bridge", e)
         return None
开发者ID:pwiiikkk,项目名称:PiHomeControl,代码行数:11,代码来源:Harmony.py

示例3: listen

# 需要导入模块: import CloudLog [as 别名]
# 或者: from CloudLog import debug [as 别名]
def listen(controller):
  component = "KeyPadController"
  runLoop = True
  modifier = None
  modTimer = datetime.min
  keyModifier = {
    "\t": "Off",
    "/": "VirginBlue",
    "*": "NightRed",
    "\x7f": "DimWhite",
    "+": "UP",
    "-": "DOWN"
  }

  while runLoop:
    CloudLog.debug(component, "Waiting for key")
    charInput = GetCh()
    CloudLog.debug(component, "Got Key")
    if modTimer + timedelta(seconds=4) < datetime.now():
      modifier = None
      modTimer = datetime.min
    if charInput == "q" or charInput == "Q":
      CloudLog.log(component, "User Interupt (Q)")
      controller.shutdown()
      runLoop = False
    elif charInput == "r" or charInput == "R":
      controller.config.read()
    elif keyModifier.get(charInput) is not None:
      modifier = keyModifier.get(charInput)
      modTimer = datetime.now()
    else:
      if charInput == "\r":
        charInput = "H"
        modifier = None
      elif charInput == "0":
        modifier = None  
      CloudLog.log(component + ":KeyPress", charInput + ":" + str(modifier))
      controller.executeCommandByKeyCode(charInput, modifier)
      modifier = None
      modTimer = datetime.min
开发者ID:Dean-Jansen,项目名称:PiHomeControl,代码行数:42,代码来源:Keypad.py

示例4: run

# 需要导入模块: import CloudLog [as 别名]
# 或者: from CloudLog import debug [as 别名]
  def run(self):
    component = "KeyPadController"
    runLoop = True
    modifier = None
    modTimer = datetime.min
    keyModifier = {
      "\t": "Off",
      "/": "VirginBlue",
      "*": "NightRed",
      "\x7f": "DimWhite",
      "+": "UP",
      "-": "DOWN"
    }

    while runLoop:
      CloudLog.debug(component, "Waiting for key")
      charInput = GetCh()
      CloudLog.debug(component, "Got Key")
      if modTimer + timedelta(seconds=4) < datetime.now():
        modifier = None
        modTimer = datetime.min
      if charInput == "q" or charInput == "Q":
        CloudLog.log(component, "User Interupt (Q)")
        runLoop = False
      elif keyModifier.get(charInput) is not None:
        modifier = keyModifier.get(charInput)
        modTimer = datetime.now()
      else:
        CloudLog.log(component + ":KeyPress", charInput + ":" + str(modifier))
        try:
          command = self._commands[charInput]
          self._announce({"command": command, "modifier": modifier})
        except:
          pass
        modifier = None
        modTimer = datetime.min
开发者ID:Dean-Jansen,项目名称:PiHomeControl,代码行数:38,代码来源:Keypad.py

示例5: str

# 需要导入模块: import CloudLog [as 别名]
# 或者: from CloudLog import debug [as 别名]
        result["request"]["activity_id"] = activity_id
        client = self._getClient()
        if client:
            try:
                response = client.start_activity(activity_id)
                result["completed"] = True
                result["response"] = response
            except Exception, e:
                CloudLog.error(self._component, "Unable to start activity", e)
                result["error"] = str(e)
            finally:
                self._disconnectClient(client)
        else:
            CloudLog.error(self._component, "No Harmony Bridge available.")
            result["error"] = "No bridge available"
        CloudLog.debug(self._component, json.dumps(result))
        return result

    def currentActivity(self):
        result = {"completed": False, "request": {}}
        result["request"]["command"] = "/currentActivity"
        client = self._getClient()
        if client:
            try:
                response = client.get_current_activity()
                result["completed"] = True
                result["response"] = response
            except Exception, e:
                CloudLog.error(self._component, "Unable to get current activity", e)
                result["error"] = str(e)
            finally:
开发者ID:pwiiikkk,项目名称:PiHomeControl,代码行数:33,代码来源:Harmony.py


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