metrics: tell what file we can't open on error
Use PDLOG and also log the filename.
BUG=chromium:467586
TEST=rebuild image and checked the log
Change-Id: I72f9838477adad71e79cc25f1f3a40bb9781b848
Reviewed-on: https://chromium-review.googlesource.com/260261
Tested-by: Stefan Sauer <ensonic@google.com>
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Stefan Sauer <ensonic@google.com>
diff --git a/metrics/serialization/serialization_utils.cc b/metrics/serialization/serialization_utils.cc
index 80e81d2..abb73ab 100644
--- a/metrics/serialization/serialization_utils.cc
+++ b/metrics/serialization/serialization_utils.cc
@@ -174,7 +174,7 @@
READ_WRITE_ALL_FILE_FLAGS));
if (file_descriptor.get() < 0) {
- DLOG(ERROR) << "error opening the file";
+ DPLOG(ERROR) << filename << ": cannot open";
return false;
}
@@ -183,7 +183,7 @@
// underneath us. Keep the file locked as briefly as possible.
// Freeing file_descriptor will close the file and and remove the lock.
if (HANDLE_EINTR(flock(file_descriptor.get(), LOCK_EX)) < 0) {
- DLOG(ERROR) << "error locking" << filename << " : " << errno;
+ DPLOG(ERROR) << filename << ": cannot lock";
return false;
}