-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hello.
I am using httpx for making GET requests. httpx logs a result of a GET request as
Message: 'HTTP Request: %s %s "%s %d %s"'
Arguments: ('GET', 'https://example.com', 'HTTP/1.1', 200, 'OK')
logredactor converts the 200 to a string '200', which causes the error, TypeError: %d format: a real number is required, not str
logredactor should not convert integers to string. Here is the line which does that, https://github.com/xtream1101/logredactor/blob/master/logredactor/redacting_filter.py#L45
Minimal example,
import re
import logging
import logredactor
# Create a logger
logger = logging.getLogger()
# Add the redact filter to the logger with your custom filters
redact_patterns = [re.compile(r'\d+')]
# if no `default_mask` is passed in, 4 asterisks will be used
logger.addFilter(logredactor.RedactingFilter(redact_patterns, default_mask='xx'))
logger.warning("This is a test %d", 123)My suggestion would be to ignore numbers, but I am not sure if that would be correct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels