[v2,4/5] libcamera: base: log: Remove `LogInvalid` check
diff mbox series

Message ID 20260119113104.3560802-5-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: base: log: Do not instantiate disabled `LogMessage`s
Related show

Commit Message

Barnabás Pőcze Jan. 19, 2026, 11:31 a.m. UTC
A `LogMessage` instance cannot be moved or copied, so a severity of
`LogInvalid` is only possible if the message was constructed with that
log level explicitly. However, being a completely internal type, this
does not occur. So remove the check. And even if it does, it's probably
still better to print the message than to drop it silently.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/libcamera/base/log.cpp | 4 ----
 1 file changed, 4 deletions(-)

Comments

Kieran Bingham Jan. 19, 2026, 12:52 p.m. UTC | #1
Quoting Barnabás Pőcze (2026-01-19 11:31:02)
> A `LogMessage` instance cannot be moved or copied, so a severity of
> `LogInvalid` is only possible if the message was constructed with that
> log level explicitly. However, being a completely internal type, this
> does not occur. So remove the check. And even if it does, it's probably
> still better to print the message than to drop it silently.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/base/log.cpp | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp
> index da45b0d65..7d308afae 100644
> --- a/src/libcamera/base/log.cpp
> +++ b/src/libcamera/base/log.cpp
> @@ -857,10 +857,6 @@ LogMessage::LogMessage(const char *fileName, unsigned int line,
>  
>  LogMessage::~LogMessage()
>  {
> -       /* Don't print anything if we have been moved to another LogMessage. */
> -       if (severity_ == LogInvalid)
> -               return;
> -
>         Logger *logger = Logger::instance();
>         if (!logger)
>                 return;
> -- 
> 2.52.0
>

Patch
diff mbox series

diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp
index da45b0d65..7d308afae 100644
--- a/src/libcamera/base/log.cpp
+++ b/src/libcamera/base/log.cpp
@@ -857,10 +857,6 @@  LogMessage::LogMessage(const char *fileName, unsigned int line,
 
 LogMessage::~LogMessage()
 {
-	/* Don't print anything if we have been moved to another LogMessage. */
-	if (severity_ == LogInvalid)
-		return;
-
 	Logger *logger = Logger::instance();
 	if (!logger)
 		return;