Skip to content

Commit 4979ff0

Browse files
committed
fix logger logic
1 parent eda6bde commit 4979ff0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ddtrace/internal/logger.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_logger(name: str) -> logging.Logger:
3131

3232
def log_filter(record: logging.LogRecord) -> bool:
3333
"""
34-
Function used to determine if a log record should be outputted or not.
34+
Function used to determine if a log record should be outputted or not (True = output, False = skip).
3535
3636
This function will:
3737
- Log all records with a level of ERROR or higher with telemetry
@@ -50,7 +50,7 @@ def log_filter(record: logging.LogRecord) -> bool:
5050
# If rate limiting has been disabled (`DD_TRACE_LOGGING_RATE=0`) then apply no rate limit
5151
# If the logger is set to debug, then do not apply any limits to any log
5252
if not _rate_limit or logger.getEffectiveLevel() == logging.DEBUG:
53-
return False
53+
return True
5454
# Allow 1 log record by name/level/pathname/lineno every X seconds
5555
# DEV: current unix time / rate (e.g. 300 seconds) = time bucket
5656
# int(1546615098.8404942 / 300) = 515538
@@ -72,9 +72,9 @@ def log_filter(record: logging.LogRecord) -> bool:
7272
# Reset our bucket
7373
_buckets[key] = LoggingBucket(current_bucket, 0)
7474
# Actually log this record
75-
return False
75+
return True
7676
# Increment the count of records we have skipped
7777
# DEV: `buckets[key]` is a tuple which is immutable so recreate instead
7878
_buckets[key] = LoggingBucket(logging_bucket.bucket, logging_bucket.skipped + 1)
7979
# Skip this log message
80-
return True
80+
return False

0 commit comments

Comments
 (0)