From patchwork Sat Jan 18 21:33:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2685 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFB58607C0 for ; Sat, 18 Jan 2020 22:34:07 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8F84997A for ; Sat, 18 Jan 2020 22:34:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1579383247; bh=Gk0IkXje+/XEZItjaqunjcjycI5ec76JYckGXi99qLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U0mcBsMoNZLi0OtbeWIz1rPrnl717wlJCw9zqn7/cb47uJ3T/+aOixHY3GV9QJer3 LBTXzmKIFwGyZi3SqmfOkpiied1UiYeykhyN+bp9HdzGc1s3lNqXXf55v8puvnzd4B 7a4pRrTo20+/ayLy43tRay7CSHTz2myIH5zThw3c= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 18 Jan 2020 23:33:48 +0200 Message-Id: <20200118213348.16561-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200118213348.16561-1-laurent.pinchart@ideasonboard.com> References: <20200118213348.16561-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: log: Print the thread ID in the log X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2020 21:34:08 -0000 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. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham --- src/libcamera/log.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp index f4eb8c11adc3..1dac4666b435 100644 --- a/src/libcamera/log.cpp +++ b/src/libcamera/log.cpp @@ -22,6 +22,7 @@ #include +#include "thread.h" #include "utils.h" /** @@ -196,7 +197,8 @@ void LogOutput::write(const LogMessage &msg) break; case LoggingTargetStream: 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()) + " " + msg.category().name() + " " + msg.fileInfo() + " " + msg.msg();