From 447cc7f8784e355cd3837f290d63c5261757dce1 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 5 Jul 2017 15:53:21 +0200 Subject: [PATCH] mxq_log: Do not deduplicate messages We intent to make loggin on info level less verbose so that we don'T need the deduplication here. At debug level we want to see all events as they happen. --- mxq_log.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/mxq_log.c b/mxq_log.c index 77b40b5f..b55f209c 100644 --- a/mxq_log.c +++ b/mxq_log.c @@ -46,45 +46,18 @@ int mx_log_print(char *msg, size_t len) { char timebuf[1024]; - static char *lastmsg = NULL; - static size_t lastlen = 0; - static int cnt = 0; - if (!msg) { - mx_free_null(lastmsg); return 0; } if (!len) return 0; - if (!*msg) - return -(errno=EINVAL); - - if (lastmsg && lastlen == len) { - if (mx_streq(msg, lastmsg)) { - cnt++; - mx_free_null(msg); - return 2; - } - } - timetag(timebuf, sizeof(timebuf)); - if (cnt > 1) - fprintf(stderr, "%s %s[%d]: last message repeated %d times\n", timebuf, program_invocation_short_name, getpid(), cnt); - else if (cnt == 1) - fprintf(stderr, "%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), lastmsg); - - if (lastmsg) - mx_free_null(lastmsg); - - lastmsg = msg; - lastlen = len; - cnt = 0; - fprintf(stderr, "%s %s[%d]: %s\n", timebuf, program_invocation_short_name, getpid(), msg); fflush(stderr); + mx_free_null(msg); return 1; }