Skip to content

fix: regression 104 and revert docstring #106

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 2 commits into from
Aug 14, 2020
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
2 changes: 1 addition & 1 deletion aws_lambda_powertools/logging/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Logger:
---------------------
POWERTOOLS_SERVICE_NAME : str
service name
LOG_LEVEL: str, int
LOG_LEVEL: str
logging level (e.g. INFO, DEBUG)
POWERTOOLS_LOGGER_SAMPLE_RATE: float
samping rate ranging from 0 to 1, 1 being 100% sampling
Expand Down
11 changes: 11 additions & 0 deletions tests/functional/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,14 @@ def test_logger_level_as_int():

# THEN we should be expected int (20, in this case)
assert logger.level == logging.INFO


def test_logger_level_env_var_as_int(monkeypatch):
# GIVEN Logger is initialized
# WHEN log level is explicitly defined via LOG_LEVEL env as int
# THEN Logger should propagate ValueError
# since env vars can only be string
# and '50' is not a correct log level
monkeypatch.setenv("LOG_LEVEL", 50)
with pytest.raises(ValueError, match="Unknown level: '50'"):
Logger()