From patchwork Tue Feb 25 17:35:53 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: 22873 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 6AD55BF415 for ; Tue, 25 Feb 2025 17:35:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 198956872E; Tue, 25 Feb 2025 18:35:59 +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="S0w79wyZ"; dkim-atps=neutral Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6138E6872E for ; Tue, 25 Feb 2025 18:35:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1740504956; x=1740764156; bh=IwldtIui0rLycRdEk/44+P4fn37khm4u5+th8XSb2r4=; 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=S0w79wyZATSE+1/nHb28oTwuHZ4JvmYtggyNhZbU64gJ5TsZhUwlc3YOxZXy4THqp xosF71nsq9CMVvLwueftxDqCArOLBkWGMqDr3xTRyELFCX/8I64wc3/lEu7n/ZDh93 BR34Xj+ETLWgtI5YZmGU/2p2TkwPkvZ109yVKEFVZkSk4RD9ah8HJpGCp6roO20Nck qqcVyXvrQRuQaYwD80TD8kNfq6PhYIEG02A9oDOtYyCaWouAj5AjX4mW1Ihvtj0kB9 T21D4DBUiW8FU7ZwydjeKuCfMNps0Eo7q2WS7TkB6Mq4ONUxUQT/T3kaemAZFMbcCD dp/T7JrF+m2AA== Date: Tue, 25 Feb 2025 17:35:53 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Cc: Laurent Pinchart Subject: [PATCH v4 3/8] libcamera: base: log: Remove `LogMessage::init()` Message-ID: <20250225173531.2595922-4-pobrn@protonmail.com> In-Reply-To: <20250225173531.2595922-1-pobrn@protonmail.com> References: <20250225173531.2595922-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: e552bf9c3a6f822c524f8e6efb7c1f98b92fd69a 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 Reviewed-by: Jacopo Mondi --- 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 b3050eedb..6d2c93019 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 42514de97..a43ed9684 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()