summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-05 14:08:46 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-08 16:23:16 +0200
commitf3829b5745be5ee448394da28b24943a807321bb (patch)
tree9ed73e78e853e9d0809dc67d988ac3e553d1a17b /src
parentce24c052de30fc19341685a3eb38485b2e9587e8 (diff)
libcamera: log: Pad timestamp fields with zeros
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/log.cpp2
1 files changed, 2 insertions, 0 deletions
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, &timestamp);
+ 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 << " ";