blob: 4c38bc5f8fe932711305ede6c39c6c4a72f1a18b [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
Ben Chana0011d82014-05-13 00:19:29 -070025 std::string GetLog(const std::string& name, DBus::Error* error);
Rebecca Silbersteine78af402014-10-02 10:55:04 -070026 LogMap GetAllLogs(DBus::Connection* connection, DBus::Error* error);
27 LogMap GetFeedbackLogs(DBus::Connection* connection, DBus::Error* error);
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080028 void GetBigFeedbackLogs(DBus::Connection* connection,
29 const DBus::FileDescriptor& fd,
30 DBus::Error* error);
Ben Chana0011d82014-05-13 00:19:29 -070031 LogMap GetUserLogFiles(DBus::Error* error);
Darin Petkovce9b3a12013-01-10 16:38:54 +010032
Elly Jones03cd6d72012-06-11 13:04:28 -040033 private:
Darin Petkovce9b3a12013-01-10 16:38:54 +010034 friend class LogToolTest;
35
36 void AnonymizeLogMap(LogMap* log_map);
Rebecca Silbersteine78af402014-10-02 10:55:04 -070037 void CreateConnectivityReport(DBus::Connection* connection);
Darin Petkovce9b3a12013-01-10 16:38:54 +010038
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080039 AnonymizerTool anonymizer_;
40
Elly Jones03cd6d72012-06-11 13:04:28 -040041 DISALLOW_COPY_AND_ASSIGN(LogTool);
42};
43
Ben Chana0011d82014-05-13 00:19:29 -070044} // namespace debugd
Elly Jones03cd6d72012-06-11 13:04:28 -040045
Alex Vakulenko262be3f2014-07-30 15:25:50 -070046#endif // DEBUGD_SRC_LOG_TOOL_H_