From patchwork Mon Jan 20 00:24:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2691 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C3513607DB for ; Mon, 20 Jan 2020 01:24:43 +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 6AA16529 for ; Mon, 20 Jan 2020 01:24:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1579479883; bh=Fi21uGDu0oFxJxnP0nwK/btgHGo7AKOL9YN71odSnMo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lH7l+Kv3zPSR9q/zG06Ck/hp6N4fEn20GlS/CtdnbnlutiS2stVSzP88/n4/D+ggn fv5EyMItUx++X1wO7kYb+UzmPhZ0wnaSeqR0vBo18bG3UAdkHEGHhscMkEjBeJJOIj stb+6gnjJD0HKJxVnveCruauJAXlPIaeuvkKu47I= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Jan 2020 02:24:22 +0200 Message-Id: <20200120002437.6633-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200120002437.6633-1-laurent.pinchart@ideasonboard.com> References: <20200120002437.6633-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/19] 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: Mon, 20 Jan 2020 00:24:44 -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: Jacopo Mondi --- 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();