Commit f1d0d164 authored by Archie Pusaka's avatar Archie Pusaka Committed by Commit Bot

feedback: Add a second bluetooth log file

When a person sign in with an @google account, a bluetooth logging
process will be started in the background which writes to a file. This
particular file has a size limit, so upon reaching the limit, it will
stop logging. To improve the condition, bluetooth team introduces
two-file log rotation system. Therefore, we now have two log files
instead of just one.

This patch adds the second log file into feedback report.

BUG=b:143118775
TEST=Do the following.
1) Observe that there is already a bluetooth log file, located in
   /var/log/bluetooth/log.bz2
2) Create another bluetooth log file /var/log/bluetooth/log.bz2.old
3) Send feedback with 'bluetooth' as the keyword and choose to attach
   bluetooth logs
4) Observe in listnr that both logs are attached.

Change-Id: I79e498ec2086f0ca92249292c6731fe868a79e4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913231Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Commit-Queue: Archie Pusaka <apusaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716075}
parent 7b047c7a
......@@ -58,8 +58,11 @@ namespace {
constexpr base::FilePath::CharType kBluetoothLogsFilePath[] =
FILE_PATH_LITERAL("/var/log/bluetooth/log.bz2");
constexpr base::FilePath::CharType kBluetoothLogsFilePathOld[] =
FILE_PATH_LITERAL("/var/log/bluetooth/log.bz2.old");
constexpr char kBluetoothLogsAttachmentName[] = "bluetooth_logs.bz2";
constexpr char kBluetoothLogsAttachmentNameOld[] = "bluetooth_logs.old.bz2";
// Getting the filename of a blob prepends a "C:\fakepath" to the filename.
// This is undesirable, strip it if it exists.
......@@ -371,6 +374,11 @@ void FeedbackPrivateSendFeedbackFunction::OnAllLogsFetched(
feedback_data->AddFile(kBluetoothLogsAttachmentName,
std::move(bluetooth_logs));
}
if (base::ReadFileToString(base::FilePath(kBluetoothLogsFilePathOld),
&bluetooth_logs)) {
feedback_data->AddFile(kBluetoothLogsAttachmentNameOld,
std::move(bluetooth_logs));
}
}
FeedbackService* service = FeedbackPrivateAPI::GetFactoryInstance()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment