@cryptotaxi247 / netdata-1 / commits / 85b274833

respect log level for all sources (#16922)

Ilya Mashchenko committed Feb 5, 2024 at 18:38 UTC 85b274833bb01e5bdef3e230f4f2e7ec6c8f26e5
1 file changed +8 -3
src/libnetdata/log/log.c
+8 -3
@@ -661,8 +661,10 @@ void nd_log_set_priority_level(const char *setting) {
661 priority = NDLP_DEBUG;
662 #endif
663
664 - nd_log.sources[NDLS_DAEMON].min_priority = priority;
665 - nd_log.sources[NDLS_COLLECTORS].min_priority = priority;
664 + for (size_t i = 0; i < _NDLS_MAX; i++) {
665 + if (i != NDLS_DEBUG)
666 + nd_log.sources[i].min_priority = priority;
667 + }
668
669 // the right one
670 setenv("NETDATA_LOG_LEVEL", nd_log_id2priority(priority), 1);
@@ -2252,7 +2254,7 @@ void netdata_logger(ND_LOG_SOURCES source, ND_LOG_FIELD_PRIORITY priority, const
2254 int saved_errno = errno;
2255 source = nd_log_validate_source(source);
2256
2255 - if((source == NDLS_DAEMON || source == NDLS_COLLECTORS) && priority > nd_log.sources[source].min_priority)
2257 + if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority)
2258 return;
2259
2260 va_list args;
@@ -2267,6 +2269,9 @@ void netdata_logger_with_limit(ERROR_LIMIT *erl, ND_LOG_SOURCES source, ND_LOG_F
2269 int saved_errno = errno;
2270 source = nd_log_validate_source(source);
2271
2272 + if (source != NDLS_DEBUG && priority > nd_log.sources[source].min_priority)
2273 + return;
2274 +
2275 if(erl->sleep_ut)
2276 sleep_usec(erl->sleep_ut);
2277