[FL-1147] System logging (#434)

* furi_log: introduce log system
* applications: rework with furi logging
* furi_log: reset color after tag printed
* core: add log info

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-04-30 14:20:33 +03:00
committed by GitHub
parent b90d72fadf
commit dd9bd224be
10 changed files with 189 additions and 35 deletions

View File

@@ -58,6 +58,7 @@ void app_loader_thread_state_callback(FuriThreadState state, void* context) {
}
int32_t app_loader(void* p) {
FURI_LOG_I("APPLOADER", "Started");
state.thread = furi_thread_alloc();
furi_thread_set_state_context(state.thread, &state);
furi_thread_set_state_callback(state.thread, app_loader_thread_state_callback);
@@ -153,7 +154,7 @@ int32_t app_loader(void* p) {
menu_item_add(menu, menu_debug);
});
printf("[app loader] start\r\n");
FURI_LOG_I("APPLOADER", "OK");
while(1) {
osThreadSuspend(osThreadGetId());

View File

@@ -72,14 +72,15 @@ int32_t application_input_dump(void* p) {
Gui* gui = furi_record_open("gui");
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
printf("[input_dump] waiting for input events\r\n");
FURI_LOG_I("INPUT DUMP", "waiting for input events");
InputDumpEvent event;
while(1) {
furi_check(osMessageQueueGet(event_queue, &event, NULL, osWaitForever) == osOK);
printf(
"[input_dump] key: %s type: %s\r\n",
FURI_LOG_I(
"INPUT DUMP",
"key: %s type: %s",
input_dump_get_key_name(event.input.key),
input_dump_get_type_name(event.input.type));
@@ -88,7 +89,7 @@ int32_t application_input_dump(void* p) {
}
}
printf("[input_dump] shutting down, byebye!\r\n");
FURI_LOG_I("INPUT DUMP", "shutting down, byebye!");
view_port_enabled_set(view_port, false);
gui_remove_view_port(gui, view_port);

View File

@@ -282,8 +282,9 @@ bool app_sd_mount_card(SdApp* sd_app) {
if(!result) {
delay(1000);
printf(
"[sd_filesystem] init(%d), error: %s\r\n",
FURI_LOG_E(
"SD FILESYSTEM",
"init(%d), error: %s\r\n",
counter,
fs_error_get_internal_desc(sd_app->info.status));
@@ -613,7 +614,7 @@ int32_t sd_filesystem(void* p) {
with_value_mutex(
menu_vm, (Menu * menu) { menu_item_add(menu, menu_item); });
printf("[sd_filesystem] start\r\n");
FURI_LOG_I("SD FILESYSTEM", "start");
// add api record
furi_record_create("sdcard", fs_api);
@@ -628,16 +629,17 @@ int32_t sd_filesystem(void* p) {
while(true) {
if(sd_was_present) {
if(hal_sd_detect()) {
printf("[sd_filesystem] card detected\r\n");
FURI_LOG_I("SD FILESYSTEM", "Card detected");
app_sd_mount_card(sd_app);
if(sd_app->info.status != SD_OK) {
printf(
"[sd_filesystem] sd init error: %s\r\n",
FURI_LOG_E(
"SD FILESYSTEM",
"sd init error: %s",
fs_error_get_internal_desc(sd_app->info.status));
app_sd_notify_error();
} else {
printf("[sd_filesystem] sd init ok\r\n");
FURI_LOG_I("SD FILESYSTEM", "sd init ok");
app_sd_notify_success();
}
@@ -645,7 +647,7 @@ int32_t sd_filesystem(void* p) {
sd_was_present = false;
if(!hal_sd_detect()) {
printf("[sd_filesystem] card removed\r\n");
FURI_LOG_I("SD FILESYSTEM", "card removed");
view_port_enabled_set(sd_app->icon.view_port, false);
app_sd_unmount_card(sd_app);
@@ -654,7 +656,7 @@ int32_t sd_filesystem(void* p) {
}
} else {
if(!hal_sd_detect()) {
printf("[sd_filesystem] card removed\r\n");
FURI_LOG_I("SD FILESYSTEM", "card removed");
view_port_enabled_set(sd_app->icon.view_port, false);
app_sd_unmount_card(sd_app);