| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_TOOLS_GDIG_FILE_NET_LOG_H_ | 5 #ifndef NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
| 6 #define NET_TOOLS_GDIG_FILE_NET_LOG_H_ | 6 #define NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 // FileNetLog is a simple implementation of NetLog that prints out all | 18 // FileNetLog is a simple implementation of NetLog that prints out all |
| 19 // the events received into the stream passed to the constructor. | 19 // the events received into the stream passed to the constructor. |
| 20 class FileNetLog : public NetLog { | 20 class FileNetLog : public NetLog { |
| 21 public: | 21 public: |
| 22 explicit FileNetLog(FILE* destination, LogLevel level); | 22 FileNetLog(FILE* destination, LogLevel level); |
| 23 virtual ~FileNetLog(); | 23 virtual ~FileNetLog(); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 // NetLog implementation: | 26 // NetLog implementation: |
| 27 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 27 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
| 28 virtual uint32 NextID() OVERRIDE; | 28 virtual uint32 NextID() OVERRIDE; |
| 29 virtual LogLevel GetLogLevel() const OVERRIDE; | 29 virtual LogLevel GetLogLevel() const OVERRIDE; |
| 30 virtual void AddThreadSafeObserver(ThreadSafeObserver* observer, | 30 virtual void AddThreadSafeObserver(ThreadSafeObserver* observer, |
| 31 LogLevel log_level) OVERRIDE; | 31 LogLevel log_level) OVERRIDE; |
| 32 virtual void SetObserverLogLevel(ThreadSafeObserver* observer, | 32 virtual void SetObserverLogLevel(ThreadSafeObserver* observer, |
| 33 LogLevel log_level) OVERRIDE; | 33 LogLevel log_level) OVERRIDE; |
| 34 virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE; | 34 virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE; |
| 35 | 35 |
| 36 base::AtomicSequenceNumber sequence_number_; | 36 base::AtomicSequenceNumber sequence_number_; |
| 37 const NetLog::LogLevel log_level_; | 37 const NetLog::LogLevel log_level_; |
| 38 | 38 |
| 39 FILE* const destination_; | 39 FILE* const destination_; |
| 40 base::Lock lock_; | 40 base::Lock lock_; |
| 41 | 41 |
| 42 base::Time first_event_time_; | 42 base::Time first_event_time_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace net | 45 } // namespace net |
| 46 | 46 |
| 47 #endif // NET_TOOLS_GDIG_FILE_NET_LOG_H_ | 47 #endif // NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
| OLD | NEW |