本文整理汇总了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)
示例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
示例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
示例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
示例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: