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