[{"id":33161,"web_url":"https://patchwork.libcamera.org/comment/33161/","msgid":"<20250124170132.GD13689@pendragon.ideasonboard.com>","date":"2025-01-24T17:01:32","subject":"Re: [RFC PATCH v1 3/7] libcamera: base: log: Remove\n\t`LogMessage::init()`","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Tue, Jan 21, 2025 at 06:55:56PM +0000, Barnabás Pőcze wrote:\n> It is a short function that can be merged into the constructor with\n> essentially no change in observable behaviour, so do that.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/base/log.h |  2 --\n>  src/libcamera/base/log.cpp   | 17 +++++------------\n>  2 files changed, 5 insertions(+), 14 deletions(-)\n> \n> diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h\n> index 620930125..d73aa7913 100644\n> --- a/include/libcamera/base/log.h\n> +++ b/include/libcamera/base/log.h\n> @@ -77,8 +77,6 @@ public:\n>  private:\n>  \tLIBCAMERA_DISABLE_COPY(LogMessage)\n>  \n> -\tvoid init(const char *fileName, unsigned int line);\n> -\n>  \tstd::ostringstream msgStream_;\n>  \tconst LogCategory &category_;\n>  \tLogSeverity severity_;\n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index 1024fed7f..1513e41fb 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -876,9 +876,12 @@ const LogCategory &LogCategory::defaultCategory()\n>  LogMessage::LogMessage(const char *fileName, unsigned int line,\n>  \t\t       const LogCategory &category, LogSeverity severity,\n>  \t\t       const std::string &prefix)\n> -\t: category_(category), severity_(severity), prefix_(prefix)\n> +\t: category_(category), severity_(severity),\n> +\t  timestamp_(utils::clock::now()), prefix_(prefix)\n>  {\n> -\tinit(fileName, line);\n> +\tstd::ostringstream ossFileInfo;\n> +\tossFileInfo << utils::basename(fileName) << \":\" << line;\n> +\tfileInfo_ = std::move(ossFileInfo).str();\n>  }\n>  \n>  /**\n> @@ -901,16 +904,6 @@ LogMessage::LogMessage(LogMessage &&other)\n>  {\n>  }\n>  \n> -void LogMessage::init(const char *fileName, unsigned int line)\n> -{\n> -\t/* Log the timestamp, severity and file information. */\n> -\ttimestamp_ = utils::clock::now();\n> -\n> -\tstd::ostringstream ossFileInfo;\n> -\tossFileInfo << utils::basename(fileName) << \":\" << line;\n> -\tfileInfo_ = ossFileInfo.str();\n> -}\n> -\n>  LogMessage::~LogMessage()\n>  {\n>  \t/* Don't print anything if we have been moved to another LogMessage. */","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5CF90C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jan 2025 17:01:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E5946855F;\n\tFri, 24 Jan 2025 18:01:45 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A64E68556\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jan 2025 18:01:43 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AA6A521C;\n\tFri, 24 Jan 2025 18:00:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AmBDLw5F\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737738038;\n\tbh=Rev61dBvdmFrqivpMd5S+krS1G6jPPz6IvfK5a0GttY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AmBDLw5FXNS+BR+vTB+4aed2w6/3V20KK6iken+4EeSG9iGtliofJ3BJAJjwp2vXp\n\th1JFMVREejcbTaY+aQbA6UXoGO8KPpOgfmbIMeJzaoaaiwbtMxnKokeXSYgVKrtsnQ\n\tv0HinedyQrm/iTc1zWQ0jZ5hGedFgz3afB1JOZUU=","Date":"Fri, 24 Jan 2025 19:01:32 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 3/7] libcamera: base: log: Remove\n\t`LogMessage::init()`","Message-ID":"<20250124170132.GD13689@pendragon.ideasonboard.com>","References":"<20250121185554.301901-1-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250121185554.301901-1-pobrn@protonmail.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]