Demo:Basical case
Demo介绍:
该部分代码储存在 bouffalo_sdk/examples/bflog/barebone_sync 路径下,主要测试该开发板不同级别的log输出功能;
filter对输出日志的过滤功能。bflog分为五个级别,分别为:
| 日志等级 | 说明 | 基本应用场景 |
|---|---|---|
| FATL | 致命错误(Fatal) | 系统无法继续运行的灾难性事件(如核心崩溃、数据损坏),需立即人工干预并终止程序。 |
| ERRO | 错误(Error) | 影响当前操作的关键错误(如功能失效、外部服务异常),但系统仍可部分运行,需尽快处理。 |
| WARN | 警告(Warning) | 非关键性异常或潜在风险(如配置降级、资源不足),需关注但无需立即行动。 |
| INFO | 信息(Info) | 常规运行状态记录(如服务启动、关键操作完成),用于监控系统健康状态。 |
| DBUG | 调试(Debug) | 开发/测试阶段的详细运行细节(如变量值、逻辑分支),用于定位问题原因。 |
| TRAC | 跟踪(Trace) | 最细粒度的执行路径追踪(如函数调用栈、循环过程),用于深度分析复杂逻辑。 |
barebone_sync:
该部分主要是裸机测试了以上的各个等级log输出,filter过滤。
部分输出:
===========================
uart sig1:ffffffff, sig2:0000f32f
clock gen1:9ffffffd, gen2:0fff0c11
xtal:40000000Hz(crystal)
board init done
===========================
============================== enable all output
[FATL][ 25338][2022-12-16 17:51:40][main.c:main:130]<MAIN> hello world this is fatal error
[ERRO][ 25858][2022-12-16 17:51:40][main.c:main:131]<MAIN> hello world this is error
[WARN][ 26355][2022-12-16 17:51:40][main.c:main:132]<MAIN> hello world this is warning
[INFO][ 26864][2022-12-16 17:51:40][main.c:main:133]<MAIN> hello world this is information
[DBUG][ 27374][2022-12-16 17:51:40][main.c:main:134]<MAIN> hello world this is degug information
[TRAC][ 27934][2022-12-16 17:51:40][main.c:main:135]<MAIN> hello world this is trace information
[FATL][ 28492][2022-12-16 17:51:40][log_test.c:test_log:13]<TEST> hello test this is fatal error
[ERRO][ 29049][2022-12-16 17:51:40][log_test.c:test_log:14]<TEST> hello test this is error
[WARN][ 29580][2022-12-16 17:51:40][log_test.c:test_log:15]<TEST> hello test this is warning
[INFO][ 30119][2022-12-16 17:51:40][log_test.c:test_log:16]<TEST> hello test this is information
[DBUG][ 30660][2022-12-16 17:51:40][log_test.c:test_log:17]<TEST> hello test this is degug information
[TRAC][ 31248][2022-12-16 17:51:40][log_test.c:test_log:18]<TEST> hello test this is trace information
============================== enable only MAIN output
[FATL][ 1031983][2022-12-16 17:51:41][log_test.c:test_log:13]<TEST> hello test this is fatal error
[ERRO][ 1032537][2022-12-16 17:51:41][log_test.c:test_log:14]<TEST> hello test this is error
[WARN][ 1033066][2022-12-16 17:51:41][log_test.c:test_log:15]<TEST> hello test this is warning
[INFO][ 1033606][2022-12-16 17:51:41][log_test.c:test_log:16]<TEST> hello test this is information
[DBUG][ 1034146][2022-12-16 17:51:41][log_test.c:test_log:17]<TEST> hello test this is degug information
[TRAC][ 1034736][2022-12-16 17:51:41][log_test.c:test_log:18]<TEST> hello test this is trace information
============================== disable all output
freertos_async:
该部分测试了在FreeRTOS下log的输出是否正常。
该case创建了两个任务,消费者和生产者,从信号队列中进行获取和放入的经典场景来测试log。
消费者任务和生产者任务具体代码放在同目录下的: thread_consumer; thread_producer;中。
部分输出: