python-elasticsearch-logger
python-elasticsearch-logger copied to clipboard
Add support for enum string parameters
For configuring logging with YAML, it would be convenient to add support for enum strings for auth_type
and index_name_frequency
. By changing this line for auth_type
in CMRESHandler.__init__()
the code can take advantage of enum's support for string lookups:
#self.auth_type = auth_type
if isinstance(auth_type, CMRESHandler.AuthType):
self.auth_type = auth_type
else:
try:
self.auth_type = CMRESHandler.AuthType[auth_type]
except KeyError:
# preserve old behavior
pass
P.S. Thank you for the package! It's been a great help for improving our Python logging.