[libcamera-devel] [PATCH 3/5] libcamera: base: log: Log to std::cerr if log file can't be opened
Umang Jain
umang.jain at ideasonboard.com
Sun May 29 13:32:51 CEST 2022
Hello,
Thank you for the patch.
On 5/26/22 00:25, Laurent Pinchart via libcamera-devel wrote:
> If the log file specified through LIBCAMERA_LOG_FILE can't be opened,
> logging is currently completely disabled. This doesn't match the
> documented behaviour that tells std::cerr is used instead. Fix it to
> match the documentation.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
> src/libcamera/base/log.cpp | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp
> index 9ae62368a54d..26f1420703b9 100644
> --- a/src/libcamera/base/log.cpp
> +++ b/src/libcamera/base/log.cpp
> @@ -517,6 +517,8 @@ void Logger::logSetLevel(const char *category, const char *level)
> */
> Logger::Logger()
> {
> + logSetStream(&std::cerr);
> +
> parseLogFile();
> parseLogLevels();
> }
> @@ -533,10 +535,8 @@ Logger::Logger()
> void Logger::parseLogFile()
> {
> const char *file = utils::secure_getenv("LIBCAMERA_LOG_FILE");
> - if (!file) {
> - logSetStream(&std::cerr);
> + if (!file)
> return;
> - }
>
> if (!strcmp(file, "syslog")) {
> logSetTarget(LoggingTargetSyslog);
More information about the libcamera-devel
mailing list