libcamera: base: log: Take LogCategory by reference

When no log category is specified, `nullptr` is passed, and
then the `_log()` function implementations replace that with
`LogCategory::defaultCategory()`. But since the call site always
knows the log category, this condition can be removed and the
`_LOG1()` macro can use `LogCategory::defaultCategory()`.

So remove the condition from the `_log()` implementations and
use references to refer to log categories.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-03-03 16:04:44 +01:00
parent 096b9416b2
commit b0db9388f6
2 changed files with 8 additions and 12 deletions

View File

@@ -952,12 +952,10 @@ Loggable::~Loggable()
*
* \return A log message
*/
LogMessage Loggable::_log(const LogCategory *category, LogSeverity severity,
LogMessage Loggable::_log(const LogCategory &category, LogSeverity severity,
const char *fileName, unsigned int line) const
{
return LogMessage(fileName, line,
category ? *category : LogCategory::defaultCategory(),
severity, logPrefix());
return LogMessage(fileName, line, category, severity, logPrefix());
}
/**
@@ -972,12 +970,10 @@ LogMessage Loggable::_log(const LogCategory *category, LogSeverity severity,
*
* \return A log message
*/
LogMessage _log(const LogCategory *category, LogSeverity severity,
LogMessage _log(const LogCategory &category, LogSeverity severity,
const char *fileName, unsigned int line)
{
return LogMessage(fileName, line,
category ? *category : LogCategory::defaultCategory(),
severity);
return LogMessage(fileName, line, category, severity);
}
/**