diff options
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) |