Is there an API to find out the current log level of a backend? If not, can we get one?

My test.exs file has been set to only log error messages to the console. We want to be able to log warnings if we wish, and have some tests that are supposed to test info messages.

Several test modules are defined to change the console backend to the required level, and then on_exit they currently reset the level to error. Because we are in the middle of converting tests to be able to work with warn we want to make the on_exit code dynamic, have it restore the original console level. However, there does not seem to be an API anywhere that would allow me to query the current backend level.

Is there something that would be the logical equivalent of log_level(:console) that would return the current level?

I found that Application.get_env(:logger, :console)[:level] gets me the information I need.