Expand regex matching to support new network ids

The logging format changed from 'Service 0' to 'Service ethernet_0'.
This changes the regex matching to support that.

Note: Some logs eliminate the 'Service' entirely, but the ones parsed
here preserve the 'Service' to make the parsing code more clear.
Comments were added to those logs in the Shill code.

This also fixes a bug in the regex for service_state which was ignoring
non failure updates.

Bug: 967800
Change-Id: I8c335b4a49b7b264510778cb215aa2882670ecc6
diff --git a/netlog_summary.js b/netlog_summary.js
index d5aceb6..77b17ff 100644
--- a/netlog_summary.js
+++ b/netlog_summary.js
@@ -72,24 +72,25 @@
     }
   },
   'service_state': {
-    re: /Service (\d+) updated; state:* (\w+) failure:* (\D+)/,
+    // In Manager::UpdateService
+    re: /Service (\w+) updated; state:* (\w+)( failure: )?(\w+)?/,
     handler: function(processingState, result) {
       var logSummary = processingState.logSummary;
       var currentManager = processingState.currentManager;
       var id = result[1];
       var state = result[2];
-      var failure = result[3];
-      if (failure == 'Unknown') {
+      var failure = result[4];  // [3] = ' failure: ' if provided.
+      if (!failure || failure == 'Unknown') {
         failure = null;
       }
       console.log('*****Service state update!');
       console.log('service [' + id + '][' + state + ']');
       console.log('managers.length: ' + logSummary.managers.length);
       console.log('managers: ', logSummary.managers);
-      console.log('failure: ' + failure);
       var currentService = currentManager.getService(id);
       var update = {state: state, time: processingState.time[0]};
       if (failure) {
+        console.log('failure: ' + failure);
         update.failure = failure;
       }
       currentService.addUpdate(update);
@@ -110,7 +111,8 @@
     }
   },
   'service_state_hint': {
-    re: /Service (\d+): state (\w+) -> (\w+)/,
+    // In Service::SetState()
+    re: /Service (\w+): state (\w+) -> (\w+)/,
     handler: function(processingState, result) {
       var id = result[1];
       var state = result[2];
@@ -124,6 +126,7 @@
     }
   },
   'service_destroyed': {
+    // In Service::~Service()
     re: /Service (\d+) destroyed/,
     handler: function(processingState, result) {
       var id = result[1];
@@ -142,7 +145,8 @@
     }
   },
   'service_connect': {
-    re: /Connecting to \S+ Service (\d+): .*/,
+    // In Service::Connect()
+    re: /Connecting to \S+ Service (\w+): .*/,
     handler: function(processingState, result) {
       logHelper.addNote(processingState.currentManager,
                         processingState.time[0],
diff --git a/state_graph.js b/state_graph.js
index f86348d..92c2dc9 100644
--- a/state_graph.js
+++ b/state_graph.js
@@ -258,8 +258,12 @@
       .attr('fill', function(d, i) {
         return d.color = color(i);
       })
-      .text(function(d) {
-        return 'service ' + d.serviceId;
+     .text(function(d) {
+        const serviceId = d.serviceId;
+        if (serviceId.match(/^\d+$/)) {
+          return 'service ' + serviceId;
+        }
+        return serviceId;
       });
 
   var haveScans = false;