libcamera log等级设置

1 LOG等级

DEBUG, INFO, WARN, ERROR, FATAL,对应数字0~4;
下面所有的export设置全局变量,都可以把DEBUG,INFO替换成对应的数值;
默认log在这里设置:

// src/libcamera/base/log.cpp
LogCategory::LogCategory(std::string_view name)
    : name_(name), severity_(LogSeverity::LogInfo)

 

2 全局设置

export LIBCAMERA_LOG_LEVELS="INFO"
./run_camtest.sh
 

3 模块设置

export LIBCAMERA_LOG_LEVELS="CAMAPP:INFO, DUMP:ERROR"
./run_camtest.sh
 

4 backtrace

在使能backtrace(设置:HAVE_BACKTRACE为1)时,如果log级别为FATAL,或者出现ASSERT失败时,都会打印自动打印backtrace。
 

5 保存log到文件

export LIBCAMERA_LOG_FILE="cam_log.txt"
./run_camtest.sh
取消保存到文件,恢复到直接打印:export LIBCAMERA_LOG_FILE=""
 

posted @ 2026-02-12 12:32  moonのsun  阅读(8)  评论(0)    收藏  举报