From 3015767e31a6174e06a3fdfa025f8f2b50a05ae1 Mon Sep 17 00:00:00 2001 From: "stevenjb@chromium.org" Date: Mon, 30 Jun 2014 20:25:10 +0000 Subject: [PATCH] Clean up Chrome OS Networking error logging * minor changes to reduce Error/Debug spam. * restores service path to Event Log to improve debugging BUG=389658 For c/b/resources/chromeos: TBR=xiyuan@chromium.org Review URL: https://codereview.chromium.org/334723006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280654 0039d316-1c4b-4281-b951-d872f2087c98 --- .../resources/chromeos/network_ui/network_ui.html | 6 ++-- .../resources/chromeos/network_ui/network_ui.js | 2 ++ chromeos/network/network_util.cc | 1 + chromeos/network/shill_property_handler.cc | 7 ++-- chromeos/network/shill_property_util.cc | 39 ++++++++++++---------- 5 files changed, 34 insertions(+), 21 deletions(-) diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui.html b/chrome/browser/resources/chromeos/network_ui/network_ui.html index 2f7f35675681..96fe54680aff 100644 --- a/chrome/browser/resources/chromeos/network_ui/network_ui.html +++ b/chrome/browser/resources/chromeos/network_ui/network_ui.html @@ -36,15 +36,16 @@ GUID + Path Name Type State Connect? Error Security - Technology + Tech Activation - Roaming + Roam OOC Strength @@ -54,6 +55,7 @@ GUID + Path Name Type Profile diff --git a/chrome/browser/resources/chromeos/network_ui/network_ui.js b/chrome/browser/resources/chromeos/network_ui/network_ui.js index 7a6dd59c8df5..6d5ce5d12f07 100644 --- a/chrome/browser/resources/chromeos/network_ui/network_ui.js +++ b/chrome/browser/resources/chromeos/network_ui/network_ui.js @@ -10,6 +10,7 @@ var NetworkUI = (function() { // specified then the first non empty value is used. var NETWORK_STATE_FIELDS = [ 'GUID', + 'service_path', 'Name', 'Type', 'ConnectionState', @@ -26,6 +27,7 @@ var NetworkUI = (function() { var FAVORITE_STATE_FIELDS = [ 'GUID', + 'service_path', 'Name', 'Type', 'profile_path', diff --git a/chromeos/network/network_util.cc b/chromeos/network/network_util.cc index 9c2067037862..d4bf554035ce 100644 --- a/chromeos/network/network_util.cc +++ b/chromeos/network/network_util.cc @@ -173,6 +173,7 @@ scoped_ptr TranslateNetworkListToONC( onc_dictionary->SetBoolean("connectable", (*it)->connectable()); onc_dictionary->SetBoolean("visible", (*it)->visible()); onc_dictionary->SetString("profile_path", (*it)->profile_path()); + onc_dictionary->SetString("service_path", (*it)->path()); std::string onc_source = (*it)->ui_data().GetONCSourceAsString(); if (!onc_source.empty()) onc_dictionary->SetString("onc_source", onc_source); diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc index 4fe7114da79a..1f789aba597c 100644 --- a/chromeos/network/shill_property_handler.cc +++ b/chromeos/network/shill_property_handler.cc @@ -520,8 +520,11 @@ void ShillPropertyHandler::GetIPConfigCallback( DBusMethodCallStatus call_status, const base::DictionaryValue& properties) { if (call_status != DBUS_METHOD_CALL_SUCCESS) { - NET_LOG_ERROR("Failed to get IP Config properties", - base::StringPrintf("%s: %d", path.c_str(), call_status)); + // IP Config properties not availabe. Shill will emit a property change + // when they are. + NET_LOG_EVENT( + base::StringPrintf("Failed to get IP Config properties: %s: %d", + ip_config_path.c_str(), call_status), path); return; } NET_LOG_EVENT("IP Config properties received", path); diff --git a/chromeos/network/shill_property_util.cc b/chromeos/network/shill_property_util.cc index 3104a5efbc78..405de1e3877d 100644 --- a/chromeos/network/shill_property_util.cc +++ b/chromeos/network/shill_property_util.cc @@ -76,8 +76,11 @@ void SetSSID(const std::string ssid, base::DictionaryValue* properties) { std::string GetSSIDFromProperties(const base::DictionaryValue& properties, bool* unknown_encoding) { - if (unknown_encoding) + bool verbose_logging = false; + if (unknown_encoding) { *unknown_encoding = false; + verbose_logging = true; + } // Get name for debugging. std::string name; @@ -87,7 +90,8 @@ std::string GetSSIDFromProperties(const base::DictionaryValue& properties, properties.GetStringWithoutPathExpansion(shill::kWifiHexSsid, &hex_ssid); if (hex_ssid.empty()) { - NET_LOG_DEBUG("GetSSIDFromProperties: No HexSSID set.", name); + if (verbose_logging) + NET_LOG_DEBUG("GetSSIDFromProperties: No HexSSID set.", name); return std::string(); } @@ -95,15 +99,14 @@ std::string GetSSIDFromProperties(const base::DictionaryValue& properties, std::vector raw_ssid_bytes; if (base::HexStringToBytes(hex_ssid, &raw_ssid_bytes)) { ssid = std::string(raw_ssid_bytes.begin(), raw_ssid_bytes.end()); - NET_LOG_DEBUG( - "GetSSIDFromProperties: " + - base::StringPrintf("%s, SSID: %s", hex_ssid.c_str(), ssid.c_str()), - name); + if (verbose_logging) { + NET_LOG_DEBUG(base::StringPrintf("GetSSIDFromProperties: %s, SSID: %s", + hex_ssid.c_str(), ssid.c_str()), name); + } } else { NET_LOG_ERROR( - "GetSSIDFromProperties: " + - base::StringPrintf("Error processing: %s", hex_ssid.c_str()), - name); + base::StringPrintf("GetSSIDFromProperties: Error processing: %s", + hex_ssid.c_str()), name); return std::string(); } @@ -123,20 +126,22 @@ std::string GetSSIDFromProperties(const base::DictionaryValue& properties, if (!encoding.empty() && base::ConvertToUtf8AndNormalize(ssid, encoding, &utf8_ssid)) { if (utf8_ssid != ssid) { - NET_LOG_DEBUG( - "GetSSIDFromProperties", - base::StringPrintf( - "Encoding=%s: %s", encoding.c_str(), utf8_ssid.c_str())); + if (verbose_logging) { + NET_LOG_DEBUG( + base::StringPrintf("GetSSIDFromProperties: Encoding=%s: %s", + encoding.c_str(), utf8_ssid.c_str()), name); + } } return utf8_ssid; } if (unknown_encoding) *unknown_encoding = true; - NET_LOG_DEBUG( - "GetSSIDFromProperties: " + - base::StringPrintf("Unrecognized Encoding=%s", encoding.c_str()), - name); + if (verbose_logging) { + NET_LOG_DEBUG( + base::StringPrintf("GetSSIDFromProperties: Unrecognized Encoding=%s", + encoding.c_str()), name); + } return ssid; } -- 2.11.4.GIT