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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_
11 #include "base/memory/linked_ptr.h"
12 #include "chrome/browser/extensions/api/log_private/log_parser.h"
13 #include "chrome/common/extensions/api/log_private.h"
15 namespace extensions
{
17 // A parser that parses syslog into LogEntry objects.
18 class SyslogParser
: public LogParser
{
21 ~SyslogParser() override
;
24 // Parses one line log text into a LogEntry object.
25 Error
ParseEntry(const std::string
& input
,
26 std::vector
<linked_ptr
<api::log_private::LogEntry
>>* output
,
27 FilterHandler
* filter_handler
) const override
;
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;
39 DISALLOW_COPY_AND_ASSIGN(SyslogParser
);
42 } // namespace extensions
44 #endif // CHROME_BROWSER_EXTENSIONS_API_LOG_PRIVATE_SYSLOG_PARSER_H_