Skip to content

Commit

Permalink
Remove hardcoded level name from log message
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Apr 3, 2023
1 parent bd442b6 commit 8f18ade
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/implementation/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ version: 1
disable_existing_loggers: false
formatters:
metrics:
format: "{asctime} {message}"
format: "{asctime} {levelname} {message}"
style: "{"
handlers:
metrics:
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def log(logger: logging.Logger, point: Point) -> None:
logger: An logger instance.
point: A measurement.
"""
logger.info("INFO METRIC: %s", point)
logger.info("METRIC: %s", point)


class Meter(metaclass=abc.ABCMeta):
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_record_counter(caplog: pytest.LogCaptureFixture):

for record in caplog.records:
assert record.levelname == "INFO"
assert record.msg == "INFO METRIC: %s"
assert record.msg == "METRIC: %s"
assert "test=1" in record.message

point: metrics.Point[int] = record.args[0]
Expand Down Expand Up @@ -89,7 +89,7 @@ def test_sync_timer(caplog: pytest.LogCaptureFixture):

record = caplog.records[0]
assert record.levelname == "INFO"
assert record.msg == "INFO METRIC: %s"
assert record.msg == "METRIC: %s"

point: metrics.Point[float] = record.args[0]
assert point.metric_type == "timer"
Expand Down

0 comments on commit 8f18ade

Please sign in to comment.