File tree 1 file changed +9
-4
lines changed
aws_lambda_powertools/logging
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 8
8
import traceback
9
9
from typing import (
10
10
IO ,
11
+ TYPE_CHECKING ,
11
12
Any ,
12
13
Callable ,
13
14
Dict ,
@@ -241,10 +242,14 @@ def __init__(
241
242
242
243
self ._init_logger (formatter_options = formatter_options , ** kwargs )
243
244
244
- def __getattr__ (self , name ):
245
- # Proxy attributes not found to actual logger to support backward compatibility
246
- # https://github.com/awslabs/aws-lambda-powertools-python/issues/97
247
- return getattr (self ._logger , name )
245
+ # Prevent __getattr__ from shielding unknown attribute errors in type checkers
246
+ # https://github.com/awslabs/aws-lambda-powertools-python/issues/1660
247
+ if not TYPE_CHECKING :
248
+
249
+ def __getattr__ (self , name ):
250
+ # Proxy attributes not found to actual logger to support backward compatibility
251
+ # https://github.com/awslabs/aws-lambda-powertools-python/issues/97
252
+ return getattr (self ._logger , name )
248
253
249
254
def _get_logger (self ):
250
255
"""Returns a Logger named {self.service}, or {self.service.filename} for child loggers"""
You can’t perform that action at this time.
0 commit comments