Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 | |||||
Alex Vakulenko | 262be3f | 2014-07-30 15:25:50 -0700 | [diff] [blame] | 5 | #ifndef DEBUGD_SRC_LOG_TOOL_H_ |
6 | #define DEBUGD_SRC_LOG_TOOL_H_ | ||||
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 7 | |
Gaurav Shah | f6c8f2a | 2012-10-11 17:22:43 -0700 | [diff] [blame] | 8 | #include <map> |
Ben Chan | 5facf4a | 2014-07-23 16:36:54 -0700 | [diff] [blame] | 9 | #include <string> |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 10 | |
Eric Caruso | 0b24188 | 2018-04-04 13:43:46 -0700 | [diff] [blame] | 11 | #include <base/files/scoped_file.h> |
Ben Chan | 657bed8 | 2014-09-02 20:40:51 -0700 | [diff] [blame] | 12 | #include <base/macros.h> |
Eric Caruso | cc7106c | 2017-04-27 14:22:42 -0700 | [diff] [blame] | 13 | #include <base/memory/ref_counted.h> |
14 | #include <dbus/bus.h> | ||||
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 15 | |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 16 | #include "debugd/src/anonymizer_tool.h" |
17 | |||||
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 18 | namespace debugd { |
19 | |||||
20 | class LogTool { | ||||
21 | public: | ||||
Eric Caruso | f9091f8 | 2017-04-28 14:18:59 -0700 | [diff] [blame] | 22 | explicit LogTool(scoped_refptr<dbus::Bus> bus) : bus_(bus) {} |
Ben Chan | 78f8953 | 2014-08-29 09:35:09 -0700 | [diff] [blame] | 23 | ~LogTool() = default; |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 24 | |
Ben Chan | 81905fb | 2017-02-08 22:03:11 -0800 | [diff] [blame] | 25 | using LogMap = std::map<std::string, std::string>; |
Elly Jones | 533c7c4 | 2012-08-10 15:07:05 -0400 | [diff] [blame] | 26 | |
Eric Caruso | c93a15c | 2017-04-24 16:15:12 -0700 | [diff] [blame] | 27 | std::string GetLog(const std::string& name); |
Eric Caruso | f9091f8 | 2017-04-28 14:18:59 -0700 | [diff] [blame] | 28 | LogMap GetAllLogs(); |
Brian Norris | ca4fc04 | 2018-04-03 00:24:26 -0700 | [diff] [blame] | 29 | LogMap GetAllDebugLogs(); |
Eric Caruso | f9091f8 | 2017-04-28 14:18:59 -0700 | [diff] [blame] | 30 | LogMap GetFeedbackLogs(); |
Eric Caruso | 0b24188 | 2018-04-04 13:43:46 -0700 | [diff] [blame] | 31 | void GetBigFeedbackLogs(const base::ScopedFD& fd); |
Eric Caruso | c93a15c | 2017-04-24 16:15:12 -0700 | [diff] [blame] | 32 | LogMap GetUserLogFiles(); |
Darin Petkov | ce9b3a1 | 2013-01-10 16:38:54 +0100 | [diff] [blame] | 33 | |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 34 | private: |
Darin Petkov | ce9b3a1 | 2013-01-10 16:38:54 +0100 | [diff] [blame] | 35 | friend class LogToolTest; |
36 | |||||
37 | void AnonymizeLogMap(LogMap* log_map); | ||||
Eric Caruso | f9091f8 | 2017-04-28 14:18:59 -0700 | [diff] [blame] | 38 | void CreateConnectivityReport(); |
39 | |||||
40 | scoped_refptr<dbus::Bus> bus_; | ||||
Darin Petkov | ce9b3a1 | 2013-01-10 16:38:54 +0100 | [diff] [blame] | 41 | |
Ahmed Fakhry | 21140cf | 2016-03-04 17:15:19 -0800 | [diff] [blame] | 42 | AnonymizerTool anonymizer_; |
43 | |||||
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 44 | DISALLOW_COPY_AND_ASSIGN(LogTool); |
45 | }; | ||||
46 | |||||
Ben Chan | a0011d8 | 2014-05-13 00:19:29 -0700 | [diff] [blame] | 47 | } // namespace debugd |
Elly Jones | 03cd6d7 | 2012-06-11 13:04:28 -0400 | [diff] [blame] | 48 | |
Alex Vakulenko | 262be3f | 2014-07-30 15:25:50 -0700 | [diff] [blame] | 49 | #endif // DEBUGD_SRC_LOG_TOOL_H_ |