summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-25 18:48:26 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-06-01 12:08:40 +0300
commit207e52b8d35e1684df20c65fe379d46bee442987 (patch)
tree74e274dee9515d9bfa31ca5133667adfb27d0bc2 /src
parent8a606e6c6735be3bab2e7e06d89b72a6626e0b3a (diff)
libcamera: base: log: Log to std::cerr if log file can't be opened
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@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/base/log.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp
index 9ae62368..26f14207 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);