blob: e9ca3336b4c2de173af641ff9e6e21156f456f00 [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
Eric Caruso0b241882018-04-04 13:43:46 -070011#include <base/files/scoped_file.h>
Ben Chan657bed82014-09-02 20:40:51 -070012#include <base/macros.h>
Eric Carusocc7106c2017-04-27 14:22:42 -070013#include <base/memory/ref_counted.h>
14#include <dbus/bus.h>
Elly Jones03cd6d72012-06-11 13:04:28 -040015
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080016#include "debugd/src/anonymizer_tool.h"
17
Elly Jones03cd6d72012-06-11 13:04:28 -040018namespace debugd {
19
20class LogTool {
21 public:
Eric Carusof9091f82017-04-28 14:18:59 -070022 explicit LogTool(scoped_refptr<dbus::Bus> bus) : bus_(bus) {}
Ben Chan78f89532014-08-29 09:35:09 -070023 ~LogTool() = default;
Elly Jones03cd6d72012-06-11 13:04:28 -040024
Ben Chan81905fb2017-02-08 22:03:11 -080025 using LogMap = std::map<std::string, std::string>;
Elly Jones533c7c42012-08-10 15:07:05 -040026
Eric Carusoc93a15c2017-04-24 16:15:12 -070027 std::string GetLog(const std::string& name);
Eric Carusof9091f82017-04-28 14:18:59 -070028 LogMap GetAllLogs();
Brian Norrisca4fc042018-04-03 00:24:26 -070029 LogMap GetAllDebugLogs();
Eric Carusof9091f82017-04-28 14:18:59 -070030 LogMap GetFeedbackLogs();
Eric Caruso0b241882018-04-04 13:43:46 -070031 void GetBigFeedbackLogs(const base::ScopedFD& fd);
Eric Carusoc93a15c2017-04-24 16:15:12 -070032 LogMap GetUserLogFiles();
Darin Petkovce9b3a12013-01-10 16:38:54 +010033
Elly Jones03cd6d72012-06-11 13:04:28 -040034 private:
Darin Petkovce9b3a12013-01-10 16:38:54 +010035 friend class LogToolTest;
36
37 void AnonymizeLogMap(LogMap* log_map);
Eric Carusof9091f82017-04-28 14:18:59 -070038 void CreateConnectivityReport();
39
40 scoped_refptr<dbus::Bus> bus_;
Darin Petkovce9b3a12013-01-10 16:38:54 +010041
Ahmed Fakhry21140cf2016-03-04 17:15:19 -080042 AnonymizerTool anonymizer_;
43
Elly Jones03cd6d72012-06-11 13:04:28 -040044 DISALLOW_COPY_AND_ASSIGN(LogTool);
45};
46
Ben Chana0011d82014-05-13 00:19:29 -070047} // namespace debugd
Elly Jones03cd6d72012-06-11 13:04:28 -040048
Alex Vakulenko262be3f2014-07-30 15:25:50 -070049#endif // DEBUGD_SRC_LOG_TOOL_H_