本文整理匯總了Python中twisted.logger.Logger.startLogging方法的典型用法代碼示例。如果您正苦於以下問題:Python Logger.startLogging方法的具體用法?Python Logger.startLogging怎麽用?Python Logger.startLogging使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twisted.logger.Logger
的用法示例。
在下文中一共展示了Logger.startLogging方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: search
# 需要導入模塊: from twisted.logger import Logger [as 別名]
# 或者: from twisted.logger.Logger import startLogging [as 別名]
def search(res):
for name, device in res.items():
log.debug(name)
for service in device['services']:
log.debug(service)
if service == u'urn:av-openhome-org:service:Product:1':
d = controller.call(res, service, 'Product')
d.addCallback(show_product)
if service == u'urn:av-openhome-org:service:Playlist:1':
d = controller.subscribe(
res, service, 'Id', show, name)
# d.addCallback(show)
elif service == u'urn:schemas-upnp-org:service:SwitchPower:1':
d = controller.subscribe(
res, service, 'Status', show, name)
def test(controller):
controller.startService()
reactor.callLater( # @UndefinedVariable
50, lambda: log.debug(controller.devices))
reactor.callLater( # @UndefinedVariable
100, controller.stopService) # @UndefinedVariable
log.startLogging(sys.stdout)
controller = Controller(
searchables=[('upnp:rootdevice', search)],
network='cloud',
cloud_user=('[email protected]', 'test'))
reactor.callWhenRunning( # @UndefinedVariable
test, controller)
reactor.run() # @UndefinedVariable