summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/net_log_logger.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 13:55:10 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 13:55:10 +0000
commit9319035b01befc8d59c9c1c7f9d83fbe15b0ba79 (patch)
tree4f871697a10d9e6b46630571edb298982b550d42 /chrome/browser/net/net_log_logger.cc
parent0e6fd884e68670a70a857d092b79fb7e71bf3856 (diff)
downloadchromium_src-9319035b01befc8d59c9c1c7f9d83fbe15b0ba79.zip
chromium_src-9319035b01befc8d59c9c1c7f9d83fbe15b0ba79.tar.gz
chromium_src-9319035b01befc8d59c9c1c7f9d83fbe15b0ba79.tar.bz2
Redirects NetLog output to the log file, when the command line
option "--log-net-log" is used. BUG= 50987 TEST= Run "chrome --log-net-log --enable-logging --log-level=0" And then check to make sure the log contains the NetLog events. Review URL: http://codereview.chromium.org/3040051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/net_log_logger.cc')
-rw-r--r--chrome/browser/net/net_log_logger.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/net/net_log_logger.cc b/chrome/browser/net/net_log_logger.cc
new file mode 100644
index 0000000..14bac0b
--- /dev/null
+++ b/chrome/browser/net/net_log_logger.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/net_log_logger.h"
+
+#include "base/json/json_writer.h"
+
+NetLogLogger::NetLogLogger() {}
+
+NetLogLogger::~NetLogLogger() {}
+
+void NetLogLogger::OnAddEntry(net::NetLog::EventType type,
+ const base::TimeTicks& time,
+ const net::NetLog::Source& source,
+ net::NetLog::EventPhase phase,
+ net::NetLog::EventParameters* params) {
+ scoped_ptr<Value> value(net::NetLog::EntryToDictionaryValue(type, time,
+ source, phase,
+ params, true));
+ std::string json;
+ base::JSONWriter::Write(value.get(), true, &json);
+ LOG(INFO) << json;
+}
+