From patchwork Mon Feb 17 18:54:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22803 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 07163C3200 for ; Mon, 17 Feb 2025 18:54:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 76B8F6868D; Mon, 17 Feb 2025 19:54:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="VVT/WXpi"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 331BA68686 for ; Mon, 17 Feb 2025 19:54:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1739818493; x=1740077693; bh=5vyz01HE8R9kF9A2i0e63Yfy0LD6JIXY9yK7jfVlbOM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=VVT/WXpiO7lNSFbquA7Li0StFetS4YQAejJzsnOsVjz6CEIVMrm0w0NMRuq1m2RCQ tWsZVPLwic3L/Ye1QCJ0Z91x5h6DUH8gcqSo44DnlGeuufnSRW0huQZghTQGtQg0h2 dE4A11XnzIEVPecvOjP/7abDvwQOMg1t8oHNbGmR6EsHxgFSIasAD7/2OdotyOC0fg wiKenSu5WPUdEUDrtn9kO6q1jn6iGcSTB+YOgtMs5p38WR/YvmeLg0swVgD/RLDUCS /gdjOuIKY3ZgAY6o3OUyZKeIaosz9En8RfXzy36lI5F+l16khf0jyXdQ5ut+L32sKO TyxghHKfhCwJw== Date: Mon, 17 Feb 2025 18:54:49 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Cc: Laurent Pinchart Subject: [PATCH v3 3/8] libcamera: base: log: Remove `LogMessage::init()` Message-ID: <20250217185433.306833-4-pobrn@protonmail.com> In-Reply-To: <20250217185433.306833-1-pobrn@protonmail.com> References: <20250217185433.306833-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 9e969836c638949c3fed503d512c1490d8dbfebd MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It is a short function that can be merged into the constructor with essentially no change in observable behaviour, so do that. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- include/libcamera/base/log.h | 2 -- src/libcamera/base/log.cpp | 16 ++++------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h index 7a101d8ba..66f665905 100644 --- a/include/libcamera/base/log.h +++ b/include/libcamera/base/log.h @@ -75,8 +75,6 @@ public: private: LIBCAMERA_DISABLE_COPY_AND_MOVE(LogMessage) - void init(const char *fileName, unsigned int line); - std::ostringstream msgStream_; const LogCategory &category_; LogSeverity severity_; diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp index 3dea1e178..7043be711 100644 --- a/src/libcamera/base/log.cpp +++ b/src/libcamera/base/log.cpp @@ -861,19 +861,11 @@ const LogCategory &LogCategory::defaultCategory() LogMessage::LogMessage(const char *fileName, unsigned int line, const LogCategory &category, LogSeverity severity, const std::string &prefix) - : category_(category), severity_(severity), prefix_(prefix) + : category_(category), severity_(severity), + timestamp_(utils::clock::now()), + fileInfo_((std::ostringstream() << utils::basename(fileName) << ":" << line).str()), + prefix_(prefix) { - init(fileName, line); -} - -void LogMessage::init(const char *fileName, unsigned int line) -{ - /* Log the timestamp, severity and file information. */ - timestamp_ = utils::clock::now(); - - std::ostringstream ossFileInfo; - ossFileInfo << utils::basename(fileName) << ":" << line; - fileInfo_ = ossFileInfo.str(); } LogMessage::~LogMessage()