Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: sync/engine/traffic_logger.cc

Issue 9663023: Log the sync communication that happens between client and server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "sync/engine/traffic_logger.h"
6
7 #include <string>
8
9 #include "base/json/json_writer.h"
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h"
13 #include "sync/protocol/proto_value_conversions.h"
14 #include "sync/protocol/sync.pb.h"
15
16 namespace browser_sync {
17
18 namespace {
19 template <class T>
20 void LogData(const T& data,
21 DictionaryValue* (*to_dictionary_value)(const T&, bool),
22 const std::string& description) {
23 if (::logging::DEBUG_MODE && VLOG_IS_ON(1)) {
24 scoped_ptr<DictionaryValue> value((*to_dictionary_value)(data,
25 true /* include_specifics */));
26 std::string message;
27 base::JSONWriter::Write(value.get(), true /* pretty_print */, &message);
28 DVLOG(1) << "\n" << description << message << "\n";
akalin 2012/03/17 01:55:05 This wasn't what I meant. Here's the line I paste
lipalani1 2012/03/19 19:24:37 Done.
29 }
30 }
31 } // namespace
32
33 void LogClientToServerMessage(const sync_pb::ClientToServerMessage& msg) {
34 LogData(msg, &ClientToServerMessageToValue,
35 "******Client To Server Message******");
36 // TODO(lipalani) : Store the data (minus specifics)
37 // in a circular buffer in memory.
38 }
39
40 void LogClientToServerResponse(
41 const sync_pb::ClientToServerResponse& response) {
42 LogData(response, &ClientToServerResponseToValue,
43 "******Server Response******");
44 // TODO(lipalani) : Store the data (minus specifics)
45 // in a circular buffer in memory.
46 }
47
48 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698