diff options
author | nirav <nirav@teisuu.com> | 2019-03-10 23:45:19 +0530 |
---|---|---|
committer | Dandelion <nirav@teisuu.com> | 2019-03-11 23:05:22 +0530 |
commit | 63e8c7f9d095fe0b1e0b44f950230c0e238f166d (patch) | |
tree | 01e0211f4fdede1eccda010fc944b3a0180a9632 /src/status.c | |
parent | 7e8ea36eb8106b4847af13a27a3e8f3177d25809 (diff) | |
download | ap_client-63e8c7f9d095fe0b1e0b44f950230c0e238f166d.tar.gz ap_client-63e8c7f9d095fe0b1e0b44f950230c0e238f166d.zip |
Add config and log
Diffstat (limited to 'src/status.c')
-rw-r--r-- | src/status.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/status.c b/src/status.c index 36cd865..139c719 100644 --- a/src/status.c +++ b/src/status.c @@ -3,6 +3,7 @@ #include <string.h> #include <jansson.h> #include "status.h" +#include "log.h" struct status *status_from_json(char *json_data) { @@ -11,7 +12,7 @@ struct status *status_from_json(char *json_data) root = json_loads(json_data, 0, &error); if (!root) { - fprintf(stderr, "status_from_json(): json parse error: line %d: %s\n", + log_msg(LOG_ERROR, "status_from_json", "json parse error: line %d: %s", error.line, error.text); return NULL; } @@ -23,19 +24,19 @@ struct status *status_from_json_t(json_t *root) { struct status *s; if (!root) { - fprintf(stderr, "status_from_json_t(): json data is null\n"); + log_msg(LOG_ERROR, "status_from_json_t", "json data is null"); return NULL; } if (!json_is_object(root)) { - fprintf(stderr, "status_from_json_t(): json root is not object\n"); + log_msg(LOG_ERROR, "status_from_json_t", "json root is not object"); json_decref(root); return NULL; } s = calloc(1, sizeof(struct status)); if (!s) { - err(1, "status_from_json_t(): failed to allocate memory"); + err(1, NULL); json_decref(root); return NULL; } @@ -94,7 +95,7 @@ struct status *status_from_json_t(json_t *root) void status_free(struct status *s) { if (!s) { - fprintf(stderr, "status_free(): status not initializes"); + log_msg(LOG_ERROR, "status_free", "status not initializes"); return; } if (s->id) |