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.
This commit is contained in:
鲁亮 2022-11-13 02:21:04 +08:00 committed by GitHub
parent f9ea34994b
commit 98e17d5117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}