diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-09 09:28:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-09 09:28:02 +0000 |
commit | 0de4e0f5c9a065a5266e34013074258675cca470 (patch) | |
tree | 70e717c6be6c919c7db306409f8a85c3828e28e8 /src | |
parent | c8e34e6d2b1aa3c22e7033f385e2408b8177af8f (diff) | |
download | gnunet-0de4e0f5c9a065a5266e34013074258675cca470.tar.gz gnunet-0de4e0f5c9a065a5266e34013074258675cca470.zip |
LRN: Fix logdef processing logic
Now if logdef matches, it is used to both allow AND restrict the call.
Diffstat (limited to 'src')
-rw-r--r-- | src/util/common_logging.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 16d367de8..ccee8e028 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -317,7 +317,6 @@ GNUNET_get_log_call_status (int caller_level, const char *comp, const char *file | |||
317 | int i; | 317 | int i; |
318 | int force_only; | 318 | int force_only; |
319 | size_t strlen_file; | 319 | size_t strlen_file; |
320 | int matches = 0; | ||
321 | 320 | ||
322 | if (comp == NULL) | 321 | if (comp == NULL) |
323 | /* Use default component */ | 322 | /* Use default component */ |
@@ -344,19 +343,11 @@ GNUNET_get_log_call_status (int caller_level, const char *comp, const char *file | |||
344 | (ld->function == NULL || strcmp (function, ld->function) == 0) | 343 | (ld->function == NULL || strcmp (function, ld->function) == 0) |
345 | ) | 344 | ) |
346 | { | 345 | { |
347 | /* This definition matched! */ | 346 | /* We're finished */ |
348 | matches += 1; | 347 | return caller_level <= ld->level; |
349 | /* And if it allows the call to be made, then we're finished */ | ||
350 | if (caller_level <= ld->level) | ||
351 | return 1; | ||
352 | } | 348 | } |
353 | } | 349 | } |
354 | /* If some definitions did match, but had too low loglevel to allow logging, | 350 | /* No matches - use global level, if defined */ |
355 | * don't check any further. | ||
356 | */ | ||
357 | if (matches > 0) | ||
358 | return 0; | ||
359 | /* Otherwise use global level, if defined */ | ||
360 | if (min_level >= 0) | 351 | if (min_level >= 0) |
361 | return caller_level <= min_level; | 352 | return caller_level <= min_level; |
362 | /* All programs/services previously defaulted to WARNING. | 353 | /* All programs/services previously defaulted to WARNING. |