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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user