OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_BASE_NET_LOG_H_ | 5 #ifndef NET_BASE_NET_LOG_H_ |
6 #define NET_BASE_NET_LOG_H_ | 6 #define NET_BASE_NET_LOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void EndEvent(NetLog::EventType event_type, | 195 void EndEvent(NetLog::EventType event_type, |
196 const scoped_refptr<NetLog::EventParameters>& params) const; | 196 const scoped_refptr<NetLog::EventParameters>& params) const; |
197 | 197 |
198 // Just like EndEvent, except |net_error| is a net error code. If it's | 198 // Just like EndEvent, except |net_error| is a net error code. If it's |
199 // negative, a parameter called "net_error" with a value of |net_error| is | 199 // negative, a parameter called "net_error" with a value of |net_error| is |
200 // associated with the event. Otherwise, the end event has no parameters. | 200 // associated with the event. Otherwise, the end event has no parameters. |
201 // |net_error| must not be ERR_IO_PENDING, as it's not a true error. | 201 // |net_error| must not be ERR_IO_PENDING, as it's not a true error. |
202 void EndEventWithNetErrorCode(NetLog::EventType event_type, | 202 void EndEventWithNetErrorCode(NetLog::EventType event_type, |
203 int net_error) const; | 203 int net_error) const; |
204 | 204 |
| 205 // Logs a byte transfer event to the NetLog. Determines whether to log the |
| 206 // received bytes or not based on the current logging level. |
| 207 void AddByteTransferEvent(NetLog::EventType event_type, |
| 208 int byte_count, char* bytes) const; |
| 209 |
205 NetLog::LogLevel GetLogLevel() const; | 210 NetLog::LogLevel GetLogLevel() const; |
206 | 211 |
207 // Returns true if the log level is LOG_ALL. | 212 // Returns true if the log level is LOG_ALL. |
208 bool IsLoggingBytes() const; | 213 bool IsLoggingBytes() const; |
209 | 214 |
210 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES. | 215 // Returns true if the log level is LOG_ALL or LOG_ALL_BUT_BYTES. |
211 bool IsLoggingAllEvents() const; | 216 bool IsLoggingAllEvents() const; |
212 | 217 |
213 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care | 218 // Helper to create a BoundNetLog given a NetLog and a SourceType. Takes care |
214 // of creating a unique source ID, and handles the case of NULL net_log. | 219 // of creating a unique source ID, and handles the case of NULL net_log. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 304 |
300 private: | 305 private: |
301 BoundNetLog net_log_; | 306 BoundNetLog net_log_; |
302 const NetLog::EventType event_type_; | 307 const NetLog::EventType event_type_; |
303 scoped_refptr<NetLog::EventParameters> end_event_params_; | 308 scoped_refptr<NetLog::EventParameters> end_event_params_; |
304 }; | 309 }; |
305 | 310 |
306 } // namespace net | 311 } // namespace net |
307 | 312 |
308 #endif // NET_BASE_NET_LOG_H_ | 313 #endif // NET_BASE_NET_LOG_H_ |
OLD | NEW |