switch to libosmocore multihread-logging
When osmo-remsim was originally developed, libosmocore logging was
not yet thread-safe. This meant that the worker threads of remsim-bankd
and remsim-server could not log via the libosmocore logging framework
but directly used stderr/stdout, which produced rather inconsistent log
output.
However, since 1.3.0, libosmocore has received support for
multi-threaded applications. Let's make use of this and consistently
use it in remsim-server and remsim-bankd. This obviously also means
adding some more log categories.
Change-Id: I7bd5264c559b756927046563a2d00c54826bee9b
diff --git a/src/server/rest_api.c b/src/server/rest_api.c
index ff1b588..540fbd4 100644
--- a/src/server/rest_api.c
+++ b/src/server/rest_api.c
@@ -304,7 +304,7 @@
rc = write(g_event_ofd.fd, &one, sizeof(one));
if (rc < 8)
- fprintf(stderr, "Error writing to eventfd(): %d\n", rc);
+ LOGP(DREST, LOGL_ERROR, "Error writing to eventfd(): %d\n", rc);
}
static int api_cb_slotmaps_post(const struct _u_request *req, struct _u_response *resp, void *user_data)
@@ -318,7 +318,7 @@
json_req = ulfius_get_json_body_request(req, &json_err);
if (!json_req) {
- fprintf(stderr, "REST: No JSON Body\n");
+ LOGP(DREST, LOGL_NOTICE, "REST: No JSON Body\n");
goto err;
}
@@ -327,7 +327,7 @@
goto err;
map = slotmap_add(g_rps->slotmaps, &slotmap.bank, &slotmap.client);
if (!map) {
- fprintf(stderr, "REST: Cannot add slotmap\n");
+ LOGP(DREST, LOGL_NOTICE, "REST: Cannot add slotmap\n");
goto err;
}
slotmap_state_change(map, SLMAP_S_NEW, NULL);
@@ -511,7 +511,7 @@
ulfius_add_endpoint(&g_instance, &api_endpoints[i]);
if (ulfius_start_framework(&g_instance) != U_OK) {
- fprintf(stderr, "Cannot start REST API on port %u\n", port);
+ LOGP(DREST, LOGL_FATAL, "Cannot start REST API on port %u\n", port);
return -1;
}
return 0;