Message ID | 20190106023328.10989-3-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your work. On 2019-01-06 04:33:20 +0200, Laurent Pinchart wrote: > 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> > --- > src/libcamera/log.cpp | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp > index 4165cbd654fc..e4d07fbbea3b 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(' '); printf() the feature I miss the most :-) Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > > msgStream << " " << log_severity_name(severity); > msgStream << " " << basename(fileName) << ":" << line << " "; > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index 4165cbd654fc..e4d07fbbea3b 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 << " ";
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> --- src/libcamera/log.cpp | 2 ++ 1 file changed, 2 insertions(+)