OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_XMPP_LOG_H_ | |
6 #define CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_XMPP_LOG_H_ | |
7 | |
8 #if LOGGING | |
9 | |
10 #include <vector> | |
11 | |
12 #include "talk/base/basictypes.h" | |
13 #include "talk/base/sigslot.h" | |
14 | |
15 namespace notifier { | |
16 | |
17 // Log the xmpp input and output. | |
18 class XmppLog : public sigslot::has_slots<> { | |
19 public: | |
20 XmppLog() : censor_password_(false) { | |
21 } | |
22 | |
23 void Input(const char* data, int len) { | |
24 xmpp_input_buffer_.insert(xmpp_input_buffer_.end(), data, data + len); | |
25 XmppPrint(false); | |
26 } | |
27 | |
28 void Output(const char* data, int len) { | |
29 xmpp_output_buffer_.insert(xmpp_output_buffer_.end(), data, data + len); | |
30 XmppPrint(true); | |
31 } | |
32 | |
33 private: | |
34 void XmppPrint(bool output); | |
35 | |
36 std::vector<char> xmpp_input_buffer_; | |
37 std::vector<char> xmpp_output_buffer_; | |
38 bool censor_password_; | |
39 DISALLOW_COPY_AND_ASSIGN(XmppLog); | |
40 }; | |
41 | |
42 } // namespace notifier | |
43 | |
44 #endif // if LOGGING | |
45 | |
46 #endif // CHROME_BROWSER_SYNC_NOTIFIER_COMMUNICATOR_XMPP_LOG_H_ | |
OLD | NEW |