1 // Copyright 2014 The Chromium 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 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DEBUG_LOG_WRITER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DEBUG_LOG_WRITER_H_ 7 8 #include "base/basictypes.h" 9 #include "base/callback_forward.h" 10 #include "base/files/file_path.h" 11 12 namespace chromeos { 13 14 class DebugLogWriter { 15 public: 16 // Called once StoreDebugLogs is complete. Takes two parameters: 17 // - log_path: where the log file was saved in the case of success; 18 // - succeeded: was the log file saved successfully. 19 typedef base::Callback<void(const base::FilePath& log_path, bool succeeded)> 20 StoreLogsCallback; 21 22 // Stores debug logs in either .tgz or .tar archive (depending on value of 23 // |should_compress|) on the |fileshelf|. The file is created on the 24 // worker pool, then writing to it is triggered from the UI thread, and 25 // finally it is closed (on success) or deleted (on failure) on the worker 26 // pool, prior to calling |callback|. 27 static void StoreLogs(const base::FilePath& fileshelf, 28 bool should_compress, 29 const StoreLogsCallback& callback); 30 31 // Stores both system and user logs in .tgz archive on the |fileshelf|. 32 // |sequence_token_name| defines named sequence for task running on 33 // blocking pool (file operations). 34 static void StoreCombinedLogs(const base::FilePath& fileshelf, 35 const std::string& sequence_token_name, 36 const StoreLogsCallback& callback); 37 38 private: 39 DebugLogWriter(); 40 DISALLOW_COPY_AND_ASSIGN(DebugLogWriter); 41 }; 42 43 } // namespace chromeos 44 45 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_LOGS_DEBUG_LOG_WRITER_H_ 46