Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: chrome/browser/chromeos/system_logs/single_log_source.h

Issue 2940493002: SingleLogSource handles rotation of log files (Closed)
Patch Set: Use constexpr; Rename bool; Simplify logic Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/system_logs/single_log_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system_logs/single_log_source.h
diff --git a/chrome/browser/chromeos/system_logs/single_log_source.h b/chrome/browser/chromeos/system_logs/single_log_source.h
index 2ffe730d9a7a59eb2910de1ab893397b4580d238..d4ddaa63d189c3ca479af43037b685bba100b6f5 100644
--- a/chrome/browser/chromeos/system_logs/single_log_source.h
+++ b/chrome/browser/chromeos/system_logs/single_log_source.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_SINGLE_LOG_SOURCE_H_
#include <stddef.h>
+#include <sys/types.h>
#include "base/files/file.h"
#include "base/macros.h"
@@ -34,8 +35,23 @@ class SingleLogSource : public SystemLogsSource {
private:
friend class SingleLogSourceTest;
+ // Returns the full path of the log file.
+ base::FilePath GetLogFilePath() const;
+
// Reads all available content from |file_| that has not already been read.
- void ReadFile(SystemLogsResponse* result);
+ // Stores results as a single entry in |result|, with |source_name()| as key
+ // and the read log contents as value.
+ //
+ // Handles rotation of underlying log file by reading all remaining contents
+ // of old file and then opening and reading from new file.
+ //
+ // |num_rotations_allowed| limits the number of rotations that can take place
+ // before the function returns. This avoids this function never returning due
+ // to indefinitely repeated log file rotation. If this number is exceeded
+ // during a call, ReadFile() stops checking for log file rotation for the
+ // remainder of its execution. Any further rotation could result in missed log
+ // data.
+ void ReadFile(size_t num_rotations_allowed, SystemLogsResponse* result);
// Path to system log file directory.
base::FilePath log_file_dir_path_;
@@ -46,6 +62,10 @@ class SingleLogSource : public SystemLogsSource {
// Handle for reading the log file that is source of logging data.
base::File file_;
+ // File system inode value that was associated with |log_file_path_| when it
+ // was originally opened for reading.
+ ino_t file_inode_;
+
// For removing PII from log results.
feedback::AnonymizerTool anonymizer_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/system_logs/single_log_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698