Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit a927894

Browse files
author
Jay Logue
committed
More work on python logging
-- Enable logging of timestamps for integration tests that use the python WeaveDeviceManager class.
1 parent 540be9b commit a927894

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test-apps/happy/lib/WeaveDeviceManager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import base64
3434
import json
3535
import set_test_path
36-
36+
import logging
3737

3838
weaveDeviceMgrPath = os.environ['WEAVE_DEVICE_MGR_PATH']
3939
print 'weaveDeviceMgrPath is %s' % weaveDeviceMgrPath
@@ -474,6 +474,13 @@ class ExtendedOption (Option):
474474

475475

476476
if __name__ == '__main__':
477+
478+
# Override the default logging for WeaveStack to include timestamps.
479+
weaveStackLogger = logging.getLogger('openweave.WeaveStack')
480+
logHandler = logging.StreamHandler(stream=sys.stdout)
481+
logHandler.setFormatter(WeaveStack.WeaveLogFormatter(logTimestamp=True))
482+
weaveStackLogger.addHandler(logHandler)
483+
weaveStackLogger.setLevel(logging.DEBUG)
477484

478485
devMgr = WeaveDeviceMgr.WeaveDeviceManager()
479486

0 commit comments

Comments
 (0)