Skip to content

Add support for enum string parameters #36

Open
@johns1342

Description

@johns1342

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions