net_log_logger.cc revision 513209b27ff55e2841eac0e4120199c23acce758
1// Copyright (c) 2010 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/net/net_log_logger.h"
6
7#include "base/json/json_writer.h"
8#include "base/values.h"
9
10NetLogLogger::NetLogLogger() : Observer(net::NetLog::LOG_ALL_BUT_BYTES) {}
11
12NetLogLogger::~NetLogLogger() {}
13
14void NetLogLogger::OnAddEntry(net::NetLog::EventType type,
15                              const base::TimeTicks& time,
16                              const net::NetLog::Source& source,
17                              net::NetLog::EventPhase phase,
18                              net::NetLog::EventParameters* params) {
19  scoped_ptr<Value> value(net::NetLog::EntryToDictionaryValue(type, time,
20                                                              source, phase,
21                                                              params, true));
22  std::string json;
23  base::JSONWriter::Write(value.get(), true, &json);
24  VLOG(1) << json;
25}
26
27