You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CfnResourceconstructor specifies that log_level should be a string.
In practice though, the log_level is used in log_helper.py to set the log level on the root logger in the stdlib logging module.
logging.root.setLevel(level)
The logging module supports both string and integers to specify the log level. As a matter of fact, the log level is stored internally as an integer. The string is translated to an int using the _checkLevel method:
def_checkLevel(level):
ifisinstance(level, int):
rv=levelelifstr(level) ==level:
iflevelnotin_nameToLevel:
raiseValueError("Unknown level: %r"%level)
rv=_nameToLevel[level]
else:
raiseTypeError("Level not an integer or a valid string: %r"%level)
returnrv
Expected behavior
log_level type hint should support both string and int.
Contribution
I am more than happy to create a PR to fix this, provided that you think it should be fixed.
The text was updated successfully, but these errors were encountered:
Hello there,
First of all: thanks a lot for the great library. It has sensibly improved our life when writing custom resources.
I have found a small inconsistency in the type hints for the
CfnResource
'slog_level
constructor parameter.Current behavior
Version affected: main branch f2095c5
CfnResource
constructor specifies thatlog_level
should be a string.In practice though, the
log_level
is used in log_helper.py to set the log level on the root logger in the stdlib logging module.The logging module supports both string and integers to specify the log level. As a matter of fact, the log level is stored internally as an integer. The string is translated to an int using the _checkLevel method:
Expected behavior
log_level
type hint should support both string and int.Contribution
I am more than happy to create a PR to fix this, provided that you think it should be fixed.
The text was updated successfully, but these errors were encountered: