From 98e17d5117916fb607973a7ba79847d46380d4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E4=BA=AE?= <806034232@qq.com> Date: Sun, 13 Nov 2022 02:21:04 +0800 Subject: [PATCH] Update log.c When you add an event level of the same file object, the current event level is retained for the same file object. --- src/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index 1a7626e..5983aaa 100644 --- a/src/log.c +++ b/src/log.c @@ -114,7 +114,7 @@ void log_set_quiet(bool enable) { int log_add_callback(log_LogFn fn, void *udata, int level) { for (int i = 0; i < MAX_CALLBACKS; i++) { - if (!L.callbacks[i].fn) { + if (!L.callbacks[i].fn || L.callbacks[i].udata == udata) { L.callbacks[i] = (Callback) { fn, udata, level }; return 0; }