From f3829b5745be5ee448394da28b24943a807321bb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 5 Jan 2019 14:08:46 +0200 Subject: libcamera: log: Pad timestamp fields with zeros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logger prints the timestamp fields with a fixed width, but pads them with spaces instead of zeros. Fix this. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/log.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 6785d371..c1ec5561 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -101,10 +101,12 @@ LogMessage::LogMessage(const char *fileName, unsigned int line, /* Log the timestamp, severity and file information. */ struct timespec timestamp; clock_gettime(CLOCK_MONOTONIC, ×tamp); + msgStream.fill('0'); msgStream << "[" << timestamp.tv_sec / (60 * 60) << ":" << std::setw(2) << (timestamp.tv_sec / 60) % 60 << ":" << std::setw(2) << timestamp.tv_sec % 60 << "." << std::setw(9) << timestamp.tv_nsec << "]"; + msgStream.fill(' '); msgStream << " " << log_severity_name(severity); msgStream << " " << basename(fileName) << ":" << line << " "; -- cgit v1.2.1