blob: 37e2a797a05c652b4ed8034e0dc3280b7134fd2a [file] [log] [blame]
Elly Jones03cd6d72012-06-11 13:04:28 -04001// 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 Vakulenko262be3f2014-07-30 15:25:50 -07005#ifndef DEBUGD_SRC_LOG_TOOL_H_
6#define DEBUGD_SRC_LOG_TOOL_H_
Elly Jones03cd6d72012-06-11 13:04:28 -04007
Gaurav Shahf6c8f2a2012-10-11 17:22:43 -07008#include <map>
Ben Chan5facf4a2014-07-23 16:36:54 -07009#include <string>
Elly Jones03cd6d72012-06-11 13:04:28 -040010
Ben Chan657bed82014-09-02 20:40:51 -070011#include <base/macros.h>
Elly Jones03cd6d72012-06-11 13:04:28 -040012#include <dbus-c++/dbus.h>
13
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080014#include "debugd/src/anonymizer_tool.h"
15
Elly Jones03cd6d72012-06-11 13:04:28 -040016namespace debugd {
17
18class LogTool {
19 public:
Ben Chan78f89532014-08-29 09:35:09 -070020 LogTool() = default;
21 ~LogTool() = default;
Elly Jones03cd6d72012-06-11 13:04:28 -040022
Ben Chan81905fb2017-02-08 22:03:11 -080023 using LogMap = std::map<std::string, std::string>;
Elly Jones533c7c42012-08-10 15:07:05 -040024
Eric Carusoc93a15c2017-04-24 16:15:12 -070025 std::string GetLog(const std::string& name);
26 LogMap GetAllLogs(DBus::Connection* connection);
27 LogMap GetFeedbackLogs(DBus::Connection* connection);
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080028 void GetBigFeedbackLogs(DBus::Connection* connection,
Eric Carusoc93a15c2017-04-24 16:15:12 -070029 const DBus::FileDescriptor& fd);
30 LogMap GetUserLogFiles();
Darin Petkovce9b3a12013-01-10 16:38:54 +010031
Elly Jones03cd6d72012-06-11 13:04:28 -040032 private:
Darin Petkovce9b3a12013-01-10 16:38:54 +010033 friend class LogToolTest;
34
35 void AnonymizeLogMap(LogMap* log_map);
Rebecca Silbersteine78af402014-10-02 10:55:04 -070036 void CreateConnectivityReport(DBus::Connection* connection);
Darin Petkovce9b3a12013-01-10 16:38:54 +010037
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080038 AnonymizerTool anonymizer_;
39
Elly Jones03cd6d72012-06-11 13:04:28 -040040 DISALLOW_COPY_AND_ASSIGN(LogTool);
41};
42
Ben Chana0011d82014-05-13 00:19:29 -070043} // namespace debugd
Elly Jones03cd6d72012-06-11 13:04:28 -040044
Alex Vakulenko262be3f2014-07-30 15:25:50 -070045#endif // DEBUGD_SRC_LOG_TOOL_H_