Skip to content

Commit ba3eb2e

Browse files
committed
fix: return subclass #107
1 parent 32549c8 commit ba3eb2e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

aws_lambda_powertools/logging/logger.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ def _is_cold_start() -> bool:
3434
return cold_start
3535

3636

37-
class Logger:
37+
# PyCharm does not support autocomplete via getattr
38+
# so we need to return to subclassing removed in #97
39+
# All methods/properties continue to be proxied to inner logger
40+
# https://github.com/awslabs/aws-lambda-powertools-python/issues/107
41+
class Logger(logging.Logger):
3842
"""Creates and setups a logger to format statements in JSON.
3943
4044
Includes service name and any additional key=value into logs
@@ -187,7 +191,8 @@ def _configure_sampling(self):
187191
self.log_level = logging.DEBUG
188192
except ValueError:
189193
raise InvalidLoggerSamplingRateError(
190-
f"Expected a float value ranging 0 to 1, but received {self.sampling_rate} instead. Please review POWERTOOLS_LOGGER_SAMPLE_RATE environment variable." # noqa E501
194+
f"Expected a float value ranging 0 to 1, but received {self.sampling_rate} instead."
195+
f"Please review POWERTOOLS_LOGGER_SAMPLE_RATE environment variable."
191196
)
192197

193198
def inject_lambda_context(self, lambda_handler: Callable[[Dict, Any], Any] = None, log_event: bool = False):

0 commit comments

Comments
 (0)