OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/net_log_logger.h" | 5 #include "net/base/net_log_logger.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 namespace net { | 53 namespace net { |
54 | 54 |
55 // This should be incremented when significant changes are made that will | 55 // This should be incremented when significant changes are made that will |
56 // invalidate the old loading code. | 56 // invalidate the old loading code. |
57 static const int kLogFormatVersion = 1; | 57 static const int kLogFormatVersion = 1; |
58 | 58 |
59 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) | 59 NetLogLogger::NetLogLogger(FILE* file, const base::Value& constants) |
60 : file_(file), log_level_(NetLog::LOG_ALL_BUT_BYTES), added_events_(false) { | 60 : file_(file), |
| 61 log_level_(NetLog::LOG_STRIP_PRIVATE_DATA), |
| 62 added_events_(false) { |
61 DCHECK(file); | 63 DCHECK(file); |
62 | 64 |
63 // Write constants to the output file. This allows loading files that have | 65 // Write constants to the output file. This allows loading files that have |
64 // different source and event types, as they may be added and removed | 66 // different source and event types, as they may be added and removed |
65 // between Chrome versions. | 67 // between Chrome versions. |
66 std::string json; | 68 std::string json; |
67 base::JSONWriter::Write(&constants, &json); | 69 base::JSONWriter::Write(&constants, &json); |
68 fprintf(file_.get(), "{\"constants\": %s,\n", json.c_str()); | 70 fprintf(file_.get(), "{\"constants\": %s,\n", json.c_str()); |
69 fprintf(file_.get(), "\"events\": [\n"); | 71 fprintf(file_.get(), "\"events\": [\n"); |
70 } | 72 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 255 } |
254 | 256 |
255 // "clientInfo" key is required for some NetLogLogger log readers. | 257 // "clientInfo" key is required for some NetLogLogger log readers. |
256 // Provide a default empty value for compatibility. | 258 // Provide a default empty value for compatibility. |
257 constants_dict->Set("clientInfo", new base::DictionaryValue()); | 259 constants_dict->Set("clientInfo", new base::DictionaryValue()); |
258 | 260 |
259 return constants_dict; | 261 return constants_dict; |
260 } | 262 } |
261 | 263 |
262 } // namespace net | 264 } // namespace net |
OLD | NEW |