Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gravitas should contain logging equivalent options #56

Open
bandophahita opened this issue Mar 2, 2023 · 5 comments
Open

gravitas should contain logging equivalent options #56

bandophahita opened this issue Mar 2, 2023 · 5 comments

Comments

@bandophahita
Copy link
Contributor

When using a pacing function the option to change the gravitas needs to have the ability to pass in the equivalent terminology used by logging module.

@beat("msg", gravitas.INFO)

This would make using gravitas more accessible to folks who are already familiar with python logging.

@bandophahita
Copy link
Contributor Author

It would be really nice if the gravitas argument accepted the adaptor values directly.

@beat("msg", logging.INFO)
aside("msg", allure.severity_level.MINOR)

We could still include gravitas.py values LIGHT etc which just point to the adaptor levels.

@bandophahita
Copy link
Contributor Author

I wasn't considering the fact a test suite might use multiple adapters (adaptor? adapter? am I British?) at same time. Which seriously complicates trying to pass in the adapter value directly.

@perrygoy
Copy link
Member

perrygoy commented Mar 4, 2023

From our conversation though, it would be nice if each adapter supplied the appropriate equivalent, just keyed back to gravitas. For example, the StdOutAdapter can provide DEBUG = gravitas.AIRY, INFO = gravitas.LIGHT, etc. That would probably be useful!

@bandophahita
Copy link
Contributor Author

I think this might be a good place to use enum. It allows the gravatas value types to still be int, while guiding the user to hint that it only accepts the values found in the appropriate enum.

@bandophahita
Copy link
Contributor Author

I think what I want to do is allow users to pass in either the int value in accordance with whatever Adapter they are using or pass in the Gravitas(StrEnum). Is that too complex for folks to follow?

So the following two lines would be equivalent
aside("foo", gravitas=logging.DEBUG) # int
aside("foo", gravitas=Gravitas.AIRY) # Enum(str)

When they pass in the integer, the narrator just passes it through. This assumes the user knows better if they are using more than one adapter.
When they pass the Enum, each adapter would have it's own translation of the gravitas levels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants