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>
This commit is contained in:
parent
ce24c052de
commit
f3829b5745
1 changed files with 2 additions and 0 deletions
|
@ -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 << " ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue