Replace some LOGs with PLOGs
PLOG automatically appends an error message appropriate
for errno, so use it when logging errors after operations
that would set errno meaningfully.
BUG=None
TEST=None
Change-Id: I63549e149bd699469293e5a7f0e48efa9e388162
Reviewed-on: https://gerrit.chromium.org/gerrit/57213
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>
diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc
index 51be283..eefe5df 100644
--- a/crash_reporter/user_collector.cc
+++ b/crash_reporter/user_collector.cc
@@ -120,7 +120,7 @@
kCorePipeLimit,
strlen(kCorePipeLimit)) !=
static_cast<int>(strlen(kCorePipeLimit))) {
- LOG(ERROR) << "Unable to write " << core_pipe_limit_file_;
+ PLOG(ERROR) << "Unable to write " << core_pipe_limit_file_;
return false;
}
std::string pattern = GetPattern(enabled);
@@ -128,7 +128,7 @@
pattern.c_str(),
pattern.length()) !=
static_cast<int>(pattern.length())) {
- LOG(ERROR) << "Unable to write " << core_pattern_file_;
+ PLOG(ERROR) << "Unable to write " << core_pattern_file_;
return false;
}
return true;
@@ -218,7 +218,7 @@
bool UserCollector::CopyOffProcFiles(pid_t pid,
const FilePath &container_dir) {
if (!file_util::CreateDirectory(container_dir)) {
- LOG(ERROR) << "Could not create " << container_dir.value().c_str();
+ PLOG(ERROR) << "Could not create " << container_dir.value().c_str();
return false;
}
FilePath process_path = GetProcessPath(pid);
@@ -262,7 +262,7 @@
const FilePath &core_path) const {
int fd = HANDLE_EINTR(open(core_path.value().c_str(), O_RDONLY));
if (fd < 0) {
- LOG(ERROR) << "Could not open core file " << core_path.value();
+ PLOG(ERROR) << "Could not open core file " << core_path.value();
return kErrorInvalidCoreFile;
}
@@ -348,7 +348,7 @@
return true;
}
- LOG(ERROR) << "Could not write core file";
+ PLOG(ERROR) << "Could not write core file";
// If the file system was full, make sure we remove any remnants.
file_util::Delete(core_path, false);
return false;