[v3,3/8] libcamera: base: log: Remove `LogMessage::init()`
diff mbox series

Message ID 20250217185433.306833-4-pobrn@protonmail.com
State Superseded
Headers show
Series
  • libcamera: base: log: Misc. changes
Related show

Commit Message

Barnabás Pőcze Feb. 17, 2025, 6:54 p.m. UTC
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 <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/base/log.h |  2 --
 src/libcamera/base/log.cpp   | 16 ++++------------
 2 files changed, 4 insertions(+), 14 deletions(-)

Patch
diff mbox series

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()