From 908626e8e19695aa5cd291e5033761ed744d5332 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 3 Mar 2018 21:23:50 +0100 Subject: [PATCH] fix logging --- src/util/client.c | 46 ++++++++++++++++++++++---------------------- src/util/mq.c | 32 +++++++++++++++--------------- src/util/scheduler.c | 14 +++++++------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/util/client.c b/src/util/client.c index 7a718fc8d..3479fa971 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -261,11 +261,11 @@ transmit_ready (void *cls) pos = (const char *) cstate->msg; len = ntohs (cstate->msg->size); GNUNET_assert (cstate->msg_off < len); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: message of type %u trying to send with socket %p (MQ: %p\n", - ntohs(cstate->msg->type), - cstate->sock, - cstate->mq); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "message of type %u trying to send with socket %p (MQ: %p\n", + ntohs(cstate->msg->type), + cstate->sock, + cstate->mq); RETRY: ret = GNUNET_NETWORK_socket_send (cstate->sock, @@ -273,13 +273,13 @@ transmit_ready (void *cls) len - cstate->msg_off); if (-1 == ret) { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - "client: error during sending message of type %u\n", - ntohs(cstate->msg->type)); + LOG (GNUNET_ERROR_TYPE_WARNING, + "Error during sending message of type %u\n", + ntohs(cstate->msg->type)); if (EINTR == errno){ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: retrying message of type %u\n", - ntohs(cstate->msg->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Retrying message of type %u\n", + ntohs(cstate->msg->type)); goto RETRY; } GNUNET_MQ_inject_error (cstate->mq, @@ -290,9 +290,9 @@ transmit_ready (void *cls) cstate->msg_off += ret; if (cstate->msg_off < len) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: rescheduling message of type %u\n", - ntohs(cstate->msg->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "rescheduling message of type %u\n", + ntohs(cstate->msg->type)); cstate->send_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, cstate->sock, @@ -302,9 +302,9 @@ transmit_ready (void *cls) GNUNET_MQ_impl_send_in_flight (cstate->mq); return; } - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: sending message of type %u successful\n", - ntohs(cstate->msg->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "sending message of type %u successful\n", + ntohs(cstate->msg->type)); cstate->msg = NULL; GNUNET_MQ_impl_send_continue (cstate->mq); } @@ -394,9 +394,9 @@ connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq, if (NULL != cstate->retry_task) GNUNET_SCHEDULER_cancel (cstate->retry_task); if (NULL != cstate->sock){ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: destroying socket: %p\n", - cstate->sock); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "destroying socket: %p\n", + cstate->sock); GNUNET_NETWORK_socket_close (cstate->sock); } cancel_aps (cstate); @@ -822,9 +822,9 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, cstate->msg = msg; cstate->msg_off = 0; if (NULL == cstate->sock){ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "client: message of type %u waiting for socket\n", - ntohs(msg->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "message of type %u waiting for socket\n", + ntohs(msg->type)); return; /* still waiting for connection */ } cstate->send_task diff --git a/src/util/mq.c b/src/util/mq.c index 33bbaa6ad..af700836c 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -358,10 +358,10 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, GNUNET_assert (NULL == mq->envelope_head); mq->current_envelope = ev; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "mq: sending message of type %u, queue empty (MQ: %p)\n", - ntohs(ev->mh->type), - mq); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "sending message of type %u, queue empty (MQ: %p)\n", + ntohs(ev->mh->type), + mq); mq->send_impl (mq, ev->mh, @@ -459,9 +459,9 @@ impl_send_continue (void *cls) mq->envelope_tail, mq->current_envelope); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "mq: sending message of type %u from queue\n", - ntohs(mq->current_envelope->mh->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "sending message of type %u from queue\n", + ntohs(mq->current_envelope->mh->type)); mq->send_impl (mq, mq->current_envelope->mh, @@ -851,9 +851,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) ev); GNUNET_assert (0 < mq->queue_length); mq->queue_length--; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MQ destroy drops message of type %u\n", - ntohs (ev->mh->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "MQ destroy drops message of type %u\n", + ntohs (ev->mh->type)); GNUNET_MQ_discard (ev); } if (NULL != mq->current_envelope) @@ -861,9 +861,9 @@ GNUNET_MQ_destroy (struct GNUNET_MQ_Handle *mq) /* we can only discard envelopes that * are not queued! */ mq->current_envelope->parent_queue = NULL; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "MQ destroy drops current message of type %u\n", - ntohs (mq->current_envelope->mh->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "MQ destroy drops current message of type %u\n", + ntohs (mq->current_envelope->mh->type)); GNUNET_MQ_discard (mq->current_envelope); mq->current_envelope = NULL; GNUNET_assert (0 < mq->queue_length); @@ -946,9 +946,9 @@ GNUNET_MQ_send_cancel (struct GNUNET_MQ_Envelope *ev) mq->envelope_tail, mq->current_envelope); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "mq: sending canceled message of type %u queue\n", - ntohs(ev->mh->type)); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "sending canceled message of type %u queue\n", + ntohs(ev->mh->type)); mq->send_impl (mq, mq->current_envelope->mh, diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 7c1a8326a..e00ca444b 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c @@ -520,8 +520,8 @@ GNUNET_SCHEDULER_shutdown () { struct GNUNET_SCHEDULER_Task *pos; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "GNUNET_SCHEDULER_shutdown\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "GNUNET_SCHEDULER_shutdown\n"); if (NULL != install_parent_control_task) { GNUNET_SCHEDULER_cancel (install_parent_control_task); @@ -2023,9 +2023,9 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) * waiting for the timeout, so we handle this gracefully. It might * also be a programming error in the driver though. */ - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "GNUNET_SCHEDULER_do_work did not find any ready " - "tasks and timeout has not been reached yet.\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "GNUNET_SCHEDULER_do_work did not find any ready " + "tasks and timeout has not been reached yet.\n"); return GNUNET_NO; } /** @@ -2376,8 +2376,8 @@ select_loop (struct GNUNET_SCHEDULER_Handle *sh, struct DriverContext *context) } if (GNUNET_YES == GNUNET_SCHEDULER_do_work (sh)) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "scheduler has more tasks ready!\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "scheduler has more tasks ready!\n"); } } GNUNET_NETWORK_fdset_destroy (rs); -- 2.25.1