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 #ifndef CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "chrome/browser/extensions/api/log_private/log_parser.h" | 12 #include "chrome/browser/extensions/api/log_private/log_parser.h" |
13 #include "chrome/common/extensions/api/log_private.h" | 13 #include "chrome/common/extensions/api/log_private.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 // A parser that parses syslog into LogEntry objects. | 17 // A parser that parses syslog into LogEntry objects. |
18 class SyslogParser : public LogParser { | 18 class SyslogParser : public LogParser { |
19 public: | 19 public: |
20 SyslogParser(); | 20 SyslogParser(); |
21 virtual ~SyslogParser(); | 21 virtual ~SyslogParser(); |
22 | 22 |
23 protected: | 23 protected: |
24 // Parses one line log text into a LogEntry object. | 24 // Parses one line log text into a LogEntry object. |
25 virtual Error ParseEntry( | 25 virtual Error ParseEntry( |
26 const std::string& input, | 26 const std::string& input, |
27 std::vector<linked_ptr<api::log_private::LogEntry> >* output, | 27 std::vector<linked_ptr<api::log_private::LogEntry> >* output, |
28 FilterHandler* filter_handler) const | 28 FilterHandler* filter_handler) const |
29 OVERRIDE; | 29 override; |
30 | 30 |
31 private: | 31 private: |
32 // Parses time token and get time in milliseconds. | 32 // Parses time token and get time in milliseconds. |
33 Error ParseTime(const std::string& input, double* output) const; | 33 Error ParseTime(const std::string& input, double* output) const; |
34 // Parses process token and get process name and ID. | 34 // Parses process token and get process name and ID. |
35 Error ParseProcess(const std::string& input, | 35 Error ParseProcess(const std::string& input, |
36 api::log_private::LogEntry* entry) const; | 36 api::log_private::LogEntry* entry) const; |
37 // Parses level token and get log level. | 37 // Parses level token and get log level. |
38 void ParseLevel(const std::string& input, | 38 void ParseLevel(const std::string& input, |
39 api::log_private::LogEntry* entry) const; | 39 api::log_private::LogEntry* entry) const; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(SyslogParser); | 41 DISALLOW_COPY_AND_ASSIGN(SyslogParser); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace extensions | 44 } // namespace extensions |
45 | 45 |
46 #endif // CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ | 46 #endif // CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_ |
OLD | NEW |