Skip to content

Commit

Permalink
options: Adjust logging level instead of disabling logging.
Browse files Browse the repository at this point in the history
During options parsing, set the logging level to ERROR and and back to
INFO once complete instead of disabling logging completely.  This will
allow us to catch genuine errors in the camera manager init phase.

Signed-off-by: Naushir Patuck <[email protected]>
  • Loading branch information
naushir committed Oct 30, 2023
1 parent b7fab73 commit 89f6fd5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ bool Options::Parse(int argc, char *argv[])
set_subdev_hdr_ctrl(0);
app_->initCameraManager();

// Unconditionally disable libcamera logging for a bit.
libcamera::logSetTarget(libcamera::LoggingTargetNone);
// Unconditionally set the logging level to error for a bit.
libcamera::logSetLevel("*", "ERROR");

std::vector<std::shared_ptr<libcamera::Camera>> cameras = app_->GetCameras();
if (camera < cameras.size())
Expand All @@ -218,8 +218,6 @@ bool Options::Parse(int argc, char *argv[])

if (list_cameras)
{
// Disable any libcamera logging for this bit.
logSetTarget(LoggingTargetNone);
LibcameraApp::verbosity = 1;

if (cameras.size() != 0)
Expand Down Expand Up @@ -338,9 +336,9 @@ bool Options::Parse(int argc, char *argv[])
return false;
}

// Reset verbosity to the user request.
// Reset log level to Info.
if (verbose)
libcamera::logSetTarget(libcamera::LoggingTargetStream);
libcamera::logSetLevel("*", "INFO");

// Set the verbosity
LibcameraApp::verbosity = verbose;
Expand Down

0 comments on commit 89f6fd5

Please sign in to comment.