libcamera: base: log: Pass dynamic prefix through
Use move construction to essentially pass through the string returned by `Loggable::logPrefix()` to avoid an unnecessary copy. 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:
@@ -858,11 +858,11 @@ const LogCategory &LogCategory::defaultCategory()
|
||||
*/
|
||||
LogMessage::LogMessage(const char *fileName, unsigned int line,
|
||||
const LogCategory &category, LogSeverity severity,
|
||||
const std::string &prefix)
|
||||
std::string prefix)
|
||||
: category_(category), severity_(severity),
|
||||
timestamp_(utils::clock::now()),
|
||||
fileInfo_(static_cast<std::ostringstream &&>(std::ostringstream() << utils::basename(fileName) << ":" << line).str()),
|
||||
prefix_(prefix)
|
||||
prefix_(std::move(prefix))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user