Skip to content
Browse files

Reformatting example with some color.

  • Loading branch information...
1 parent f1bc5f8 commit 930b1506fcecabc96bec17f5fe12c9a1a348dc66 @TooTallNate committed Sep 4, 2011
Showing with 15 additions and 13 deletions.
  1. +15 −13 examples/spy.js
View
28 examples/spy.js
@@ -1,14 +1,16 @@
-var upnp = require('../lib/upnp');
-var util = require('util');
-var log = function(event) {
- return function(device) {
- console.log('UPNP Event %s: %s, %s', event, device.nt || device.st, device.usn);
- };
-};
+var upnp = require('../')
+ , inspect = require('util').inspect
+ , log = function(event) {
+ return function(device) {
+ console.log('UPNP Event: \033[33m%s\033[39m', event)
+ console.log(inspect(device, true, 10, true))
+ console.log()
+ }
+ }
-cp = new upnp.ControlPoint();
-cp.on('DeviceAvailable', log('DeviceAvailable'));
-cp.on('DeviceUpdated', log('DeviceUpdated'));
-cp.on('DeviceUnavailable', log('DeviceUnavailable'));
-cp.on('DeviceFound', log('DeviceFound'));
-cp.search();
+cp = new upnp.ControlPoint()
+cp.on('DeviceAvailable', log('DeviceAvailable'))
+cp.on('DeviceUpdated', log('DeviceUpdated'))
+cp.on('DeviceUnavailable', log('DeviceUnavailable'))
+cp.on('DeviceFound', log('DeviceFound'))
+cp.search()

0 comments on commit 930b150

Please sign in to comment.
Something went wrong with that request. Please try again.