Chromium Code Reviews| Index: components/metrics/serialization/serialization_utils.cc |
| diff --git a/components/metrics/serialization/serialization_utils.cc b/components/metrics/serialization/serialization_utils.cc |
| index d57b51b2c08f09e3c9f87dacc146f40a11f4d8d3..9b05a6d84090b46305e68be2295caca697de047c 100644 |
| --- a/components/metrics/serialization/serialization_utils.cc |
| +++ b/components/metrics/serialization/serialization_utils.cc |
| @@ -122,7 +122,7 @@ void SerializationUtils::ReadAndTruncateMetricsFromFile( |
| result = stat(filename.c_str(), &stat_buf); |
| if (result < 0) { |
| if (errno != ENOENT) |
| - DPLOG(ERROR) << filename << ": bad metrics file stat"; |
| + DPLOG(ERROR) << " bad metrics file stat: " << filename << " : " << errno; |
|
Ilya Sherman
2015/04/15 22:50:38
Why do you have a leading space at the start of ea
Ilya Sherman
2015/04/15 22:50:38
To the best of my knowledge, DPLOG already appends
d.samantaray
2015/04/16 08:56:30
Done.
d.samantaray
2015/04/16 08:56:30
Done.
d.samantaray
2015/04/16 08:56:30
Done.
|
| // Nothing to collect---try later. |
| return; |
| @@ -133,12 +133,12 @@ void SerializationUtils::ReadAndTruncateMetricsFromFile( |
| } |
| base::ScopedFD fd(open(filename.c_str(), O_RDWR)); |
| if (fd.get() < 0) { |
| - DPLOG(ERROR) << filename << ": cannot open"; |
| + DPLOG(ERROR) << " cannot open: " << filename << " : " << errno; |
| return; |
| } |
| result = flock(fd.get(), LOCK_EX); |
| if (result < 0) { |
| - DPLOG(ERROR) << filename << ": cannot lock"; |
| + DPLOG(ERROR) << "cannot lock: " << filename << " : " << errno; |
| return; |
| } |
| @@ -157,11 +157,11 @@ void SerializationUtils::ReadAndTruncateMetricsFromFile( |
| result = ftruncate(fd.get(), 0); |
| if (result < 0) |
| - DPLOG(ERROR) << "truncate metrics log"; |
| + DPLOG(ERROR) << "truncate metrics log: " << filename << " : " << errno; |
| result = flock(fd.get(), LOCK_UN); |
| if (result < 0) |
| - DPLOG(ERROR) << "unlock metrics log"; |
| + DPLOG(ERROR) << "unlock metrics log: " << filename << " : " << errno; |
| } |
| bool SerializationUtils::WriteMetricToFile(const MetricSample& sample, |
| @@ -174,7 +174,7 @@ bool SerializationUtils::WriteMetricToFile(const MetricSample& sample, |
| READ_WRITE_ALL_FILE_FLAGS)); |
| if (file_descriptor.get() < 0) { |
| - DLOG(ERROR) << "error openning the file"; |
| + DLOG(ERROR) << "error openning the file: " << filename << " : " << errno; |
|
Ilya Sherman
2015/04/15 22:50:38
Rather than adding errno, can you use DPLOG? (App
d.samantaray
2015/04/16 08:56:30
Done.
|
| return false; |
| } |
| @@ -190,7 +190,7 @@ bool SerializationUtils::WriteMetricToFile(const MetricSample& sample, |
| std::string msg = sample.ToString(); |
| int32 size = msg.length() + sizeof(int32); |
| if (size > kMessageMaxLength) { |
| - DLOG(ERROR) << "cannot write message: too long"; |
| + DLOG(ERROR) << "cannot write message: too long" << " : " << errno; |
|
Ilya Sherman
2015/04/15 22:50:38
Did you mean to include the filename here, as well
d.samantaray
2015/04/16 08:56:30
Done.
|
| return false; |
| } |
| @@ -199,13 +199,13 @@ bool SerializationUtils::WriteMetricToFile(const MetricSample& sample, |
| if (!base::WriteFileDescriptor(file_descriptor.get(), |
| reinterpret_cast<char*>(&size), |
| sizeof(size))) { |
| - DPLOG(ERROR) << "error writing message length"; |
| + DPLOG(ERROR) << "error writing message length" << " : " << errno; |
| return false; |
| } |
| if (!base::WriteFileDescriptor( |
| file_descriptor.get(), msg.c_str(), msg.size())) { |
| - DPLOG(ERROR) << "error writing message"; |
| + DPLOG(ERROR) << "error writing message" << " : " << errno; |
| return false; |
| } |