Skip to content

adding logging format lint check #4525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ def _get_temporality(
_logger.warning(
"Unrecognized OTEL_EXPORTER_METRICS_TEMPORALITY_PREFERENCE"
" value found: "
f"{otel_exporter_otlp_metrics_temporality_preference}, "
"using CUMULATIVE"
"%s, "
"using CUMULATIVE",
otel_exporter_otlp_metrics_temporality_preference,
)
instrument_class_temporality = {
Counter: AggregationTemporality.CUMULATIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def _read_file(file_path: str) -> Optional[bytes]:
return file.read()
except FileNotFoundError as e:
logger.exception(
f"Failed to read file: {e.filename}. Please check if the file exists and is accessible."
"Failed to read file: %s. Please check if the file exists and is accessible.",
e.filename,
)
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ def __exit__(self, exc_type, exc_value, traceback):
# pylint: disable=broad-exception-caught
except Exception as error_handling_error:
logger.exception(
"%s error while handling error"
" %s by error handler %s",
"%s error while handling error %s by error handler %s",
error_handling_error.__class__.__name__,
exc_value.__class__.__name__,
error_handler_class.__name__,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ select = [
"PLC", # pylint convention
"PLE", # pylint error
"Q", # flake8-quotes
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
]

ignore = [
Expand Down