mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 00:55:07 +03:00
libcamera: log: Print the thread ID in the log
The current thread ID is useful when debugging concurrency issues. Print it in log messages. The syslog target is left out as the thread ID would have little use there, and partly duplicates the process ID. The log messages now look as follows. [19:10:33.206560546] [22096] INFO Camera camera_manager.cpp:274 libcamera v0.0.0+993-32696686 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
1d929967b7
commit
026b3af8c2
1 changed files with 3 additions and 1 deletions
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <libcamera/logging.h>
|
#include <libcamera/logging.h>
|
||||||
|
|
||||||
|
#include "thread.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +197,8 @@ void LogOutput::write(const LogMessage &msg)
|
||||||
break;
|
break;
|
||||||
case LoggingTargetStream:
|
case LoggingTargetStream:
|
||||||
case LoggingTargetFile:
|
case LoggingTargetFile:
|
||||||
str = "[" + utils::time_point_to_string(msg.timestamp()) + "]"
|
str = "[" + utils::time_point_to_string(msg.timestamp()) + "] ["
|
||||||
|
+ std::to_string(Thread::currentId()) + "]"
|
||||||
+ log_severity_name(msg.severity()) + " "
|
+ log_severity_name(msg.severity()) + " "
|
||||||
+ msg.category().name() + " " + msg.fileInfo() + " "
|
+ msg.category().name() + " " + msg.fileInfo() + " "
|
||||||
+ msg.msg();
|
+ msg.msg();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue