Browse Source

update: json convert result in debug log

dev
Dnomd343 2 years ago
parent
commit
6fe2c7c93f
  1. 1
      src/applet/adguard.c
  2. 2
      src/common/json.c

1
src/applet/adguard.c

@ -94,7 +94,6 @@ process* adguard_load(adguard *info, const char *dir) { // load adguard options
} else { // configure exist -> modify
char *adguard_config_content = read_file(adguard_config_file);
char *adguard_config_json = to_json(adguard_config_content);
log_debug("AdGuardHome json configure ->\n%s", adguard_config_json);
adguard_config_ret = adguard_config(info, adguard_config_json);
free(adguard_config_content);
free(adguard_config_json);

2
src/common/json.c

@ -22,9 +22,11 @@ char* to_json(const char *content) { // convert JSON / TOML / YAML to json forma
char *json_content = strdup(json_string); // load string into owner heap
free_rust_string(json_string); // free rust string
if (strlen(json_content) == 0) { // empty string -> convert error
log_warn("JSON convert error ->\n%s", content);
free(json_content);
return NULL;
}
log_debug("JSON convert result ->\n%s", json_content);
return json_content;
}

Loading…
Cancel
Save