libcamera: base: log: Remove LogMessage::init()

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>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze 2025-01-21 18:30:11 +01:00
parent 8fa119e0b5
commit 5d0af9840b
2 changed files with 4 additions and 14 deletions

View file

@ -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_;

View file

@ -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_(static_cast<std::ostringstream &&>(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()