From 69a27f15b05628f1a4bb137f8af5c163194819a4 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 17 Feb 2008 06:02:45 +0000 Subject: [PATCH] don't log lost logs of 0 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7656 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_event_socket/mod_event_socket.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index f834bc02bc..332ed128cd 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -109,13 +109,15 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l char *data = strdup(node->data); if (data) { if (switch_queue_trypush(l->log_queue, data) == SWITCH_STATUS_SUCCESS) { - int ll = l->lost_logs; - switch_event_t *event; - l->lost_logs = 0; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Lost %d log lines!\n", ll); - if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "info", "lost %d log lines", ll); - switch_event_fire(&event); + if (l->lost_logs) { + int ll = l->lost_logs; + switch_event_t *event; + l->lost_logs = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Lost %d log lines!\n", ll); + if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "info", "lost %d log lines", ll); + switch_event_fire(&event); + } } } else { switch_safe_free(data);